SQL Programming Manual for TAL

NonStop SQL Statements and Directives
HP NonStop SQL Programming Manual for TAL527887-001
3-31
RELEASE
Follow these guidelines when you use the PREPARE statement:
A prepared statement is associated only with the program that executes the
PREPARE statement. Only that program can execute the prepared statement.
The prepared statement remains available for execution until one of the following
events occur:
°
The current process terminates
°
A statement with the same name (either specified as a literal or with a
°
statement host variable) is prepared again
°
The statement name is successfully released with a RELEASE statement
If a statement is prepared again, the previously compiled statement is released at
the beginning of the second prepare operation and the original statement is not
available if the second prepare operation fails.
The PREPARE statement must appear in the same procedure as the DESCRIBE
INPUT and DESCRIBE statements, the RELEASE statement, and the EXECUTE or
cursor statements (DECLARE CURSOR, OPEN, FETCH, DELETE WHERE
CURRENT, UPDATE WHERE CURRENT, and CLOSE) that are used to execute the
SQL input statement.
Using Statistics Information
If a program declares an SQLSA structure and the PREPARE statement completes
without any errors, NonStop SQL returns compilation statistics to the SQLSA structure.
These statistics include information needed by the program to build the SQLDA
structures for subsequent DESCRIBE and EXECUTE statements. For more
information about the SQLSA and SQLDA structures, see Section 6, Error and Status
Processing.
RELEASE
The RELEASE statement deallocates space for a dynamic SQL statement that is
prepared from a host variable.
The RELEASE statement must appear in the same procedure as the PREPARE
statement, the DESCRIBE INPUT and DESCRIBE statements, and the EXECUTE or
cursor statements (DECLARE CURSOR, OPEN, FETCH, CLOSE) that are used to
execute the SQL statement.
SELECT
The SELECT statement typically retrieves data from one or more tables and views into
host variables. There are two types of SELECT statements that you can use in a
program: