EXECUTE

Function

The EXECUTE statement executes a prepared statement.

Invocation 

Embedded Mode P

Dynamic Mode  

Interactive Mode  

 

Syntax

 

execute_statement.bmp

statement_identifier

A valid identifier denoting the name of the prepared statement which is to be executed.

host_variable_identifier

A valid single host variable identifier. It must have been defined in the application program according to the host language rules. The value of the host variable must be the value returned by the PREPARE statement and thus identifying the prepared statement.

USING clause

Defines an SQL descriptor area used to provide dynamic input variables if required by the statement to be executed.  

   

Description

The EXECUTE statement executes the prepared statement identified by a statement identifier or host variable identifier. If the prepared statement contains host variable markers, then values must be provided to satisfy these. In this case, a USING clause is required.  

Limitations

The statement indicated by statement identifier, host variable identifier must be a successfully prepared statement.

A previously prepared SELECT statement cannot be submitted to the EXECUTE statement.

ANSI Specifics

None.

 

Adabas SQL Gateway Embedded SQL Specifics

A host variable identifier can be used to identify the prepared statement.

This statement may be mixed with any other DML, DDL and/or DCL statements in the same transaction.

 

Example

The following example executes a prepared statement.

 

EXECUTE statement_identifier;

 

The following example executes a prepared statement that requires 3 values.

 

EXECUTE statement_identifier USING :hv1, :hv2, :hv3 ;

 

The following example executes a prepared statement where the input information is stored in the SQLDA.

 

EXECUTE statement_identifier USING DESCRIPTOR

:input_sqlda;