Embedded SQL Variable Declaration Sections
Embedded SQL statements use C variables to transfer data from the database or form into the program. You must declare C variables to SQL before you can use them in any embedded SQL statement.
Example: C variables declared to SQL in a declaration section
exec sql begin declare section;
C variable and type declarations
exec sql end declare section;
Do not place a label in front of the exec sql end declare section statement because it causes a preprocessor syntax error.
Embedded SQL variable declarations are global to the program file from the point of declaration onwards. You can incorporate multiple declaration sections into a single program, as is the case when a few different C procedures issue embedded statements using local variables. Each procedure can have its own declaration section. For more information on the declaration of variables and types that are local to C procedures, see
The Scope of Variables (see page
The Scope of Variables) in this chapter.