Oracle DDL trigger , identify a "drop column"

Asked

Viewed 51 times

0

In Oracle it is possible to create DDL triggers (Data Definition Language) something like

create or replace trigger trg_ddl
   before ddl
    on database
  declare
  begin
  ...
  end; 

My , doubt , how to recognize a column deletion event from a table ?

ALTER TABLE <TABLE> DROP COLUMN <COLUMN>

Doubt about syntax, I hope to be in accordance with the rules.

  • Is it common to drop columns there? Just curious, usually you do not do many triggers for these events, drop permissions should be more restricted... about your question, see these variavies of the oracle and test in your Rigger: ORA_SYSEVENT and ORA_DICT_OBJ_NAME the first one usually brings in the event "alter", "truncate", it may take the "drop" too, the second one will show the table (I’m thinking your Trigger should be for the whole database, or schema), this should help to catch something

  • There is an automatic process of ERP making lambança it does not find the Oracle column in the dictionary and drop the columns.

  • As almost always someone has been through the problem. https://stackoverflow.com/questions/43980081/oracle-ddl-trigger

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.