DEV Community

Query Filter
Query Filter

Posted on

trunc table

SET SERVEROUTPUT ON
SPOOL truncate_log.txt

BEGIN
EXECUTE IMMEDIATE 'TRUNCATE TABLE my_table';
DBMS_OUTPUT.PUT_LINE('Table MY_TABLE truncated successfully.');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error truncating table MY_TABLE: ' || SQLERRM);
END;
/
SPOOL OFF

Top comments (0)