Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > EXECUTE IMMEDIATE >

EXECUTE IMMEDIATE and Restricted Statements

You cannot use the EXECUTE IMMEDIATE statement to execute the following SQL statements. Although the EXECUTE PROCEDURE statement appears on this list, the restriction applies only to EXECUTE PROCEDURE statements that return values.

CLOSE
CONNECT
DECLARE
DISCONNECT
EXECUTE
EXECUTE FUNCTION
EXECUTE PROCEDURE
FETCH
GET DESCRIPTOR
GET DIAGNOSTICS

OPEN
OUTPUT
PREPARE
SELECT
SET AUTOFREE
SET CONNECTION
SET DEFERRED_PREPARE
SET DESCRIPTOR
WHENEVER

In addition, you cannot use the EXECUTE IMMEDIATE statement to execute the following statements in text that contains multiple statements that are separated by semicolons:

CLOSE DATABASE
CREATE DATABASE
DATABASE

DROP DATABASE
SELECT (except SELECT INTO TEMP)

Use the PREPARE statement and either a cursor or the EXECUTE statement to execute a dynamically constructed SELECT statement.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]