oracle drop temporary table code example

Example: oracle drop temporary table

CREATE OR REPLACE PROCEDURE p AS
    table_or_view_not_exist EXCEPTION;
    PRAGMA EXCEPTION_INIT (table_or_view_not_exist, -942);
    attempted_ddl_on_in_use_GTT EXCEPTION;
    PRAGMA EXCEPTION_INIT (attempted_ddl_on_in_use_GTT, -14452);
BEGIN
    EXECUTE IMMEDIATE 'DROP TABLE t';

EXCEPTION
    WHEN table_or_view_not_exist THEN
        dbms_output.put_line('Table t did not exist at drop time. Continuing.');

    WHEN attempted_ddl_on_in_use_GTT THEN
        dbms_output.put_line('Help ! Someone is doing my job!');
        dbms_output.put_line('Please rescue me');
        RAISE;
END p;

Tags:

Sql Example