4. Embedded SQL for Fortran : Fortran Variables and Data Types : Variable Usage
 
Share this page                  
Variable Usage
Fortran variables declared in an Embedded SQL declaration section can substitute for most elements of Embedded SQL statements that are not keywords. Of course, the variable and its data type must make sense in the context of the element. When you use a Fortran variable in an Embedded SQL statement, you must precede it with a colon (:). You must further verify that the statement using the variable is in the scope of the variable's declaration. As an example, the following select statement uses the variables "namevar" and "numvar" to receive data and the variable "idno" as an expression in the where clause.
Example: Fortran variables usage
 exec sql select ename, eno
1   into :namevar, :numvar
2   from employee
3   where eno = :idno
Various rules and restrictions apply to the use of Fortran variables in Embedded SQL statements. The following sections describe the usage syntax of different categories of variables and provide examples of such use.