Procedures
The syntax for an Embedded SQL/Pascal procedure is:
procedure procedure_name
[exec sql begin declare section;
(formal_parameters)
exec sql end declare section;]
;
[exec sql begin declare section;
declarations
exec sql end declare section;]
begin
[statements]
end;
or:
procedure procedure_name
[exec sql begin declare section;
(formal_parameters)
exec sql end declare section;]
;
exec sql label;
[exec sql begin declare section;
declarations
exec sql end declare section;]
begin
[statements]
exec sql end;
Syntax Notes:
1. The procedure_name is not processed by Embedded SQL.
2. Formal parameters and variables declared in a procedure are visible globally to the end of the source file.
3. For a description of formal parameters and their syntax, see
Formal Parameter Declarations (see page
Formal Parameter Declarations) in this chapter.
The following is an example of an Embedded SQL/Pascal procedure:
procedure AppendRow
exec sql begin declare section;
( name : varying[20] of Char;
age : Integer;
salary : Real )
exec sql end declare section;
;
begin
exec sql insert into emp (name, age, salary)
values (:name, :age, :salary);
end;