Unable to fire DDL trigger before the dropping the table

I want to create a trigger that throws the error on dropping the table in the oracle live sql. In my code the trigger is created successfully but on trying to drop the table the different error i.e., Encountered the symbol "Drop" is shown

Code:

CREATE OR REPLACE TRIGGER drop_trigger  
   BEFORE DROP ON SCHEMA
   BEGIN 
      RAISE_APPLICATION_ERROR (-20000,'Cannot drop the table'); 
   END; 
 
  drop table emp;

Error:

Errors: TRIGGER DROP_TRIGGER
Line/Col: 5/3 PLS-00103: Encountered the symbol "DROP" 

Also tried to replace the line "BEFORE DROP ON SCHEMA" with "BEFORE DROP ON DATABASE"

and new error came i.e. "ORA-01031: insufficient privileges "

The code is performed on Oracle Live Sql



Read more here: https://stackoverflow.com/questions/64410952/unable-to-fire-ddl-trigger-before-the-dropping-the-table

Content Attribution

This content was originally published by M J at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: