|
|
EXECUTE
Associates parameter values with a previously prepared SQL statement and executes the statement.
Usage
Description
The prepared statement identified by the statement name is executed.
If the source form of the prepared statement contains parameter markers, the
EXECUTEstatement must be used with theUSINGclause to correctly associate the statement parameters with the allocated SQL descriptor area or an appropriate number of host variables.Use
INTOfor a singletonSELECTstatement where the result-set consists of only one row. For example:SELECT COUNT(*)The
DESCRIBE INPUTstatement can be used to determine thePARAMETER_MODEof each of the parameters in the prepared statement.If parameter markers are present, the
USINGclause must be used to specify an SQL descriptor area or a list of host variables for these parameters. There must be one variable in the host variables list or `referenced' in the SQL descriptor area for each parameter in the prepared statement. The variables are associated with the parameter markers in a left to right manner as they appear in the prepared statement.The data types of the variables must be compatible with their usage in the source statement.
The
descriptor-nameis identified by a host variable or a literal.See ALLOCATE CURSOR for a description of extended statements.
For a fuller discussion of the use of
EXECUTEstatements in dynamic application programs, see the Mimer SQL Programmer's Manual, Dynamic SQL.Restrictions
The
EXECUTEstatement may only be used for dynamically prepared statements.Dynamically prepared
SELECTstatements and calls to result-set procedures may not be executed. These should be performed using a sequence ofOPEN,FETCHandCLOSEstatements, i.e. using a cursor.Note: You can use singleton SELECT statements or calls to result-set procedures if the result-set will contain only one row.
See the Mimer SQL Programmer's Manual, Communicating with the Application Program for information on the format of the host variable.
Example
exec sql PREPARE 'stmt 1' FROM :sqlstr; exec sql ALLOCATE DESCRIPTOR 'DescrIn'; exec sql DESCRIBE INPUT 'stmt 1' USING SQL DESCRIPTOR 'DescrIn'; ... exec sql EXECUTE 'stmt 1' USING SQL DESCRIPTOR 'DescrIn';For more information, see the Mimer SQL Programmer's Manual, Executable Statements.
Standard Compliance
|
Mimer Information Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 info@mimer.se |
|
|