CREATE OR REPLACE PROCEDURE CreateDynamicTables(
p_Method IN VARCHAR2) AS
v_CreateString1 VARCHAR2(100) := 'CREATE TABLE dbms_sql_table (f1 NUMBER)';
v_CreateString2 VARCHAR2(100) := 'CREATE TABLE native_table (f1 NUMBER)';
v_Dummy INTEGER;
v_CursorID INTEGER;
BEGIN
IF p_Method = 'DBMS_SQL' THEN
v_CursorID := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(v_CursorID, v_CreateString1, DBMS_SQL.NATIVE);
DBMS_SQL.CLOSE_CURSOR(v_CursorID);
ELSE
EXECUTE IMMEDIATE v_CreateString2;
END IF;
END CreateDynamicTables;
/
exec CreateDynamicTables('DBMS_SQL')
exec CreateDynamicTables('native')
DROP TABLE dbms_sql_table;
DROP TABLE native_table;
--
|