4. Embedded SQL for Fortran : Fortran Variables and Data Types : Variable and Type Declarations : Embedded SQL Variable Declaration Sections
 
Share this page                  
Embedded SQL Variable Declaration Sections
Embedded SQL statements use Fortran variables to transfer data between the database, or a form, and the program. You can also use Fortran constants in those SQL statements transferring data from the program into the database. You must declare Fortran variables, constants and structure definitions to SQL before using them in any Embedded SQL statements. The preprocessor does not allow the declaration of Fortran variables by implication. Fortran variables are declared to SQL in a declaration section. This section has the following syntax:
exec sql begin declare section
         Fortran variable declarations
exec sql end declare section
Embedded SQL variable declarations are global to the program file from the point of declaration onward. Multiple declaration sections can be incorporated into a single file, as is the case when a few different Fortran subprograms issue embedded statements using local variables. Each subprogram can have its own declaration section. For more information on the declaration of variables and types that are local to Fortran subprograms see The Scope of Variables in this chapter.