General Summary of Dynamic SQL Processing
The following statements are used when SQL statements are dynamically submitted:
ALLOCATE CURSOR Allocate extended cursor. ALLOCATE DESCRIPTOR Allocate SQL descriptor area. CLOSE Close an open cursor. DEALLOCATE DESCRIPTOR Deallocate SQL descriptor area. DEALLOCATE PREPARE Deallocate prepared SQL statement. DECLARE CURSOR Declare a cursor for a statement which will be dynamically submitted. DESCRIBE Examine the object form of the statement and assign values to the appropriate parameters in the SQL descriptor area. EXECUTE Execute a prepared statement (except result set generating statements). EXECUTE IMMEDIATE Shorthand form for PREPARE followed by EXECUTE. This form can only be used for fully-defined non-result set statements with no parameter markers. FETCH Fetch rows for a dynamic cursor. GET DESCRIPTOR Get values from the SQL descriptor area. OPEN Open a prepared cursor. PREPARE Compile an SQL source statement into an internal object form. SET DESCRIPTOR Set values in the SQL descriptor area.
All statements submitted to dynamic SQL programs must be prepared.
All prepared statements except SELECT statements and result set procedure calls are executed with the EXECUTE statement. SELECT statements and calls to result set procedures are "executed" by the use of OPEN and FETCH for a cursor declared with the prepared statement.
The declaration of a cursor for a statement (DECLARE CURSOR) must always precede the PREPARE operation for the same statement in an application using dynamic SQL.
Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40