EXECUTE IMMEDIATE and Restricted Statements
The EXECUTE IMMEDIATE statement cannot execute the following SQL statements.
- CLOSE
- CONNECT
- DECLARE
- DISCONNECT
- EXECUTE
- EXECUTE FUNCTION
- EXECUTE PROCEDURE
- FETCH
- FLUSH
- FREE
- GET DESCRIPTOR
- GET DIAGNOSTICS
- OPEN
- OUTPUT
- PREPARE
- PUT
- SELECT
- SET AUTOFREE
- SET CONNECTION
- SET DEFERRED_PREPARE
- SET DESCRIPTOR
- WHENEVER
The only form of the SELECT statement that EXECUTE IMMEDIATE supports as statement text is SELECT ... INTO TEMP table. For the syntax of the INTO TEMP table clause in SELECT statements, see INTO table clauses.
In addition, ESQL/C cannot use the EXECUTE IMMEDIATE statement
to execute the following statements in text that contains multiple
SQL statements that are separated by semicolons:
- CLOSE DATABASE
- CREATE DATABASE
- DATABASE
- DROP DATABASE
- SELECT (except SELECT INTO TEMP)
(In SPL routines, the EXECUTE IMMEDIATE statement can execute only a single SQL statement. If the specification that immediately follows the IMMEDIATE keyword evaluates to a list of multiple SQL statements, or by a NULL value, or text that is not a valid SQL statement, the database server issues a runtime error.)