The native dynamic SQL statements pertaining to dynamic DDL, DML, and session control are as follows:
EXECUTE IMMEDIATE
EXECUTE IMMEDIATE
EXECUTE IMMEDIATE
OPEN
OPEN
FETCH
CLOSE
EXECUTE IMMEDIATE ‘BEGIN… . END;’ USING
The first two statements are used for dynamic DDL. The third statement is used for single-row dynamic SELECTS. The fourth through seventh statements are used for multirow dynamic SELECTS. The last statement is used for dynamic PL/SQL.
The whole string including BEGIN and END is constructed dynamically by concatenation. The EXECUTE IMMEDIATE statement prepares, executes, and deallocates a dynamic SQL statement. The OPEN statement extends the OPEN cursor statements for opening cursors based on a dynamic SQL query constructed as a string. The FETCH and CLOSE statements extend the FETCH and CLOSE cursor statements to support dynamic queries. The last statement enables dynamic PL/SQL (i.e., executing procedures and functions whose names are constructed at runtime or anonymous PL/SQL blocks involving runtime variables).
Native dynamic SQL supports SQL-specific data types. However, it doesn't support PL/SQL-specific data types such as BOOLEAN, index-by tables, and user-defined records. The only exception to this rule is fetching into user-defined records while executing dynamic single-row and multirow queries.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15225049/viewspace-628432/ ,如需转载,请注明出处,否则将追究法律责任。