EXECUTE statement [ESQL]
514
EXECUTE statement [ESQL]
Use this statement to execute a prepared SQL statement.
EXECUTE
statement
…[ USING { DESCRIPTOR
sqlda-name
|
host-variable-list
]
…[ INTO { DESCRIPTOR
into-sqlda
-
name
|
into-host
-
variable-list
]
…[ ARRAY :
integer
]
statement: identifier
|
host-variable
|
string
sqlda-name: identifier
into-sqlda-name: identifier
EXECUTE IMMEDIATE
statement
statement
:
string
|
host-variable
Permissions are checked on the statement being executed.
None.
"EXECUTE IMMEDIATE statement" on page 518
"PREPARE statement" on page 578
"DECLARE CURSOR statement" on page 488
The EXECUTE statement can be used for any SQL statement that can be
prepared. Cursors are used for SELECT statements or CALL statements that
return many rows from the database (see "Cursors in Embedded SQL" on
page 33 of the book ASA Programming Interfaces Guide).
After successful execution of an INSERT, UPDATE or DELETE statement,
the sqlerrd[2] field of the SQLCA (SQLCOUNT) is filled in with the
number of rows affected by the operation.
Syntax 1 Execute the named dynamic statement, which was previously
prepared. If the dynamic statement contains host variable place holders
which supply information for the request (bind variables), either the sqlda-
name must specify a C variable which is a pointer to an SQLDA containing
enough descriptors for all of the bind variables occurring in the statement, or
the bind variables must be supplied in the host-variable-list.
Syntax 2 A short form to PREPARE and EXECUTE a statement that does
not contain bind variables or output. The SQL statement contained in the
string or host-variable is immediately executed, and is dropped on
completion.
Function
Syntax 1
Syntax 2
Permissions
Side effects
See also
Description