SQL Programming Manual for Pascal

Error and Status Processing
HP NonStop SQL Programming Manual for Pascal528614-001
6-14
Declaring the SQLDA and Names Buffer
Declaring the SQLDA and Names Buffer
Use the INCLUDE SQLDA directive to declare a record description for the SQLDA in a
Pascal program using dynamic SQL statements. The syntax is:
sqlda-name
is the SQLDA structure name.
sqlvar-count
is the number of parameters for which you expect to specify input values or
number of columns for which you expect to receive output values. The default is 1.
Instead of specifying an arbitrary number for columns to be selected or parameters
to be expected, you can use dynamic memory allocation to allocate space for input
parameters and output variables as they become known to the program. This
feature is illustrated in the detailed dynamic SQL sample program in Appendix C,
Examples of Dynamic NonStop SQL Programs.
names-buffer-name
is the number of characters in the longest column name or input parameter name
you expect to be returned in a DESCRIBE or DESCRIBE INPUT statement. A
column name can be from 1 to 30 characters long.
name-string-size
is the number of characters in the longest parameter or column name expected in
the input statement.
The SQL compiler determines the length in bytes of the names buffer using this
formula:
length = ( name-string-size + 11 ) * sqlvar-count
The compiler derives the 11 bytes added to the name-string-size from:
length field 2 bytes
table name 8 bytes
separator (-) 1 byte
RELEASE1 or RELEASE2
is the NonStop SQL release. The default is the release of the Pascal compiler,
unless it is overridden by the release option parameter in the SQL directive.
INCLUDE SQLDA ( sqlda-name [ , sqlvar-count]
[ , names-buffer-name, name-string-size ]
[ , { RELEASE1 | RELEASE2 } ] )