4. Embedded SQL for Fortran : Fortran Variables and Data Types : Variable Usage : Simple Variables
 
Share this page                  
Simple Variables
The following syntax refers to a simple scalar-valued variable (integer, real or character string):
:simplename
Syntax Notes:
If you use the variable to send values to Ingres, it can be any scalar-valued variable.
If you use the variable to receive values from Ingres, it must be a scalar-valued variable.
The following program fragment demonstrates a typical error handling routine, which can be called either directly or by a whenever statement. The variables "buffer" and "buflen" are scalar-valued variables.
Example: Simple variables usage
subroutine ErrHnd

exec sql include sqlca

exec sql begin declare section
          parameter (buflen = 100)
          character*(buflen) buffer
exec sql end declare section

exec sql whenever sqlerror continue
exec sql inquire_sql (:buffer= errrortext)
print *, 'the following error occurred aborting session.'
print *, buffer
exec sql abort
         ...
end