Was this helpful?
Calling Database Procedures
Database procedures are composed of SQL statements and are stored as objects in the database. You use the SQL create procedure statement to create database procedures outside of ABF.
The following SQL code creates the database procedure tax_emp():
create procedure tax_emp(
  employee_id integer not null,
  tax_percent integer not null)
as
begin
  /* processing statements */
end;
You then can call this procedure from within an application with the following 4GL statement:
retval = tax_emp (employee_id, 5);
The following rules apply to database procedures:
Database procedures cannot contain data definition statements, such as create table.
Database procedures cannot create or drop other procedures.
Database procedures cannot call other procedures or frames.
You cannot use a repeated clause in a database procedure; the procedure itself provides the same benefits as the repeated clause.
A select statement in a database procedure must assign its results to local variables; if the statement returns more than one row of data, only the first row is assigned to the result variable.
You can use procedure parameters or local variables in place of constant values in a database procedure.
Database procedures cannot contain any statements that refer to forms.
See the description of the create procedure statement in the SQL Reference Guide for a more detailed discussion of database procedures, including a list of SQL statements that they can contain.
Last modified date: 04/03/2024