Only Dynamic Server supports this statement. Use this statement with ESQL/C.
>>-EXECUTE--+-stmt_id-----+--+----------------------+-----------> '-stmt_id_var-' | (1) | '-| INTO Clause |------' >--+-----------------------+----------------------------------->< | (2) | '-| USING Clause |------'
Element | Description | Restrictions | Syntax |
---|---|---|---|
stmt_id | Identifier of a prepared SQL statement | Must have been declared in a previous PREPARE statement | Identifier |
stmt_id_var | Host variable containing the identifier of a prepared statement | Must exist and must contain a statement identifier that a previous PREPARE statement declared, and must be of a character data type | PREPARE |
The EXECUTE statement passes a prepared SQL statement to the database server for execution. The following example shows an EXECUTE statement within an ESQL/C program:
EXEC SQL PREPARE del_1 FROM 'DELETE FROM customer WHERE customer_num = 119'; EXEC SQL EXECUTE del_1;
Once prepared, an SQL statement can be executed as often as needed.
After you release the database server resources (using a FREE statement), you cannot use the statement identifier with a DECLARE cursor or with the EXECUTE statement until you prepare the statement again.
If the statement contained question mark ( ? ) placeholders, use the USING clause to provide specific values for them before execution. For more information, see the USING Clause.
You can execute any prepared statement except those in the following list:
When you use a prepared SELECT statement to return multiple rows of data, you must use a cursor to retrieve the data rows. As an alternative, you can EXECUTE a prepared SELECT INTO TEMP statement to achieve the same result.
For more information on cursors, see DECLARE .
When you prepare an EXECUTE FUNCTION (or EXECUTE PROCEDURE) statement to invoke an SPL function that returns multiple rows, you must use a cursor to retrieve the data rows.
For more information on how to execute a SELECT or an EXECUTE FUNCTION (or EXECUTE PROCEDURE) statement, see PREPARE.
If you create or drop a trigger after you prepare a triggering INSERT, DELETE, or UPDATE statement, the prepared statement returns an error when you execute it.
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]