Embedded SQL Variable Declaration Sections
Embedded SQL statements use Pascal variables to transfer data from the database or a form into the program and vice versa. You must declare Pascal variables and constants to Embedded SQL before using them in any Embedded SQL statements. Pascal variables, types, and constants are declared to Embedded SQL in a declaration section. This section has the following syntax:
exec sql begin declare section;
Pascal constant, type and variable declarations
exec sql end declare section;
Note that placing a label in front of the exec sql end declare section statement causes a preprocessor syntax error.
Embedded SQL variable declarations are global to the program file from the point of declaration onwards. Multiple declaration sections can be incorporated into a single program, as would be the case when a few different Pascal procedures issue embedded statements using local variables. Each procedure can have its own declaration section. For more information on the declaration of variables that are local to Pascal procedures, see
The Scope of Variables (see page
The Scope of Variables) in this chapter.