SQL Programming Manual for Pascal

NonStop SQL Statements and Directives
HP NonStop SQL Programming Manual for Pascal528614-001
3-14
DELETE WHERE CURRENT and Dynamic SQL
Cursors
DELETE WHERE CURRENT and Dynamic SQL Cursors
For a dynamic SQL cursor, all statements referencing the cursor must be in the
procedure where the cursor is defined; however, if you open the cursor and use it in
one call to the procedure where it is defined, you can still use the cursor in subsequent
calls without opening the cursor again.
For more information on cursors, see SELECT on page 3-29.
DESCRIBE and DESCRIBE INPUT
The DESCRIBE statement returns information about output variables (usually selected
columns) associated with a previously prepared dynamic SQL statement. DESCRIBE
fills in an SQLDA and names buffer with the descriptions and names of the columns.
The DESCRIBE INPUT statement returns the same type of information about input
parameters.
The following guidelines apply to DESCRIBE and DESCRIBE INPUT:
If a program declares an SQLSA, DESCRIBE and DESCRIBE INPUT return the
same compilation statistics that PREPARE returns for the OUTPUT_NUM,
OUTPUT_NAMES_LEN, INPUT_NUM, and INPUT_NAMES_LEN fields. For more
information on this, see the SQLSA description in Section 6, Error and Status
Processing.
Both DESCRIBE and DESCRIBE INPUT must be in the same procedure as the
PREPARE statement and the EXECUTE statement or cursor statements
(DECLARE CURSOR, OPEN, FETCH, CLOSE) that process the dynamic SQL
input statement.
DESCRIBE and DESCRIBE INPUT set the SQLDA NULL_INFO field depending
on whether the prepared SQL statement includes a null indicator and not on
whether the column definition allows a null value.
To determine if a column allows a null value, check the NULLALLOWED column in
the COLUMNS catalog table for the catalog where the table is registered. To
determine the catalog where the table is registered, call the FILEINQUIRE
procedure with the table name and an item code of 14.
EXECUTE
The EXECUTE statement executes a previously prepared dynamic SQL statement.
You can use EXECUTE for any DDL, DML, or DCL statement except SELECT. (Use a
cursor to process a SELECT statement.)
The EXECUTE statement must be in the same procedure as the PREPARE,
DESCRIBE INPUT, and DESCRIBE statements that are used to process the dynamic
SQL input statement.