开始
SET serveroutput ON; DECLARE p_tab_name varchar2(20); cursor_name INTEGER; p_rows_del INTEGER; BEGIN p_tab_name := 'EMP_CPY'; cursor_name := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(cursor_name, 'DELETE FROM '||p_tab_name, DBMS_SQL.NATIVE); DBMS_OUTPUT.PUT_LINE('p_tab_name:'|| p_tab_name); p_rows_del := DBMS_SQL.EXECUTE (cursor_name); DBMS_SQL.CLOSE_CURSOR(cursor_name); EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(SUBSTR(SQLERRM,1,100)); END;
结束