SQL>
SQL> CREATE OR REPLACE PROCEDURE exec_ddl
2 (p_statement_txt VARCHAR2) IS
3 lv_exec_cursor_num INTEGER := DBMS_SQL.OPEN_CURSOR;
4 lv_rows_processed_num NUMBER := 0;
5 lv_statement_txt VARCHAR2(30000);
6 BEGIN
7 lv_statement_txt := p_statement_txt;
8 DBMS_SQL.PARSE (lv_exec_cursor_num, lv_statement_txt,
9 DBMS_SQL.NATIVE);
10 lv_rows_processed_num := DBMS_SQL.EXECUTE (lv_exec_cursor_num);
11 DBMS_SQL.CLOSE_CURSOR (lv_exec_cursor_num);
12 EXCEPTION
13 WHEN OTHERS THEN
14 IF DBMS_SQL.IS_OPEN (lv_exec_cursor_num) THEN
15 DBMS_SQL.CLOSE_CURSOR (lv_exec_cursor_num);
16 END IF;
17 RAISE;
18 END exec_ddl;
19 /
Procedure created.
SQL>
|