Oracle system trigger fired twice on drop table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rhitam30111985
    New Member
    • Aug 2007
    • 112

    Oracle system trigger fired twice on drop table

    Hi all,

    I am using Oracle 11g on windows 2003 server R2 standard edition service pack 2. I am trying to create a trigger within a schema called "inventory" by logging in as the schema owner. Here is my code for the same:

    Code:
      create or replace TRIGGER AUDIT_SYS_TR_TEST
       AFTER  ALTER OR DROP ON DATABASE
      BEGIN
        IF(ora_sysevent = 'DROP' AND UPPER(ora_login_user) not in ('SYS','SYSTEM')) THEN
         DBMS_OUTPUT.PUT_LINE(ora_sysevent);
        ELSIF(ora_sysevent = 'ALTER' AND UPPER(ora_login_user) not in ('SYS','SYSTEM')) THEN
         DBMS_OUTPUT.PUT_LINE(ora_sysevent);
        END IF;
      END;
    The aim is to fire the trigger whenever alter or drop occurs on a database object(ie any database object). So I created a table called trigtest like this within the same schema as the trigger:

    Code:
    CREATE TABLE TRIGTEST(COL1 VARCHAR(20));
    Then I tried dropping the table:

    Code:
     DROP TABLE TRIGTEST;
    This is what I got as serveroutput after the drop statement :

    ALTER
    DROP

    I have attached the whole operation as an attachment while this was being executed in SQLPLUS. Can someone please throw some light as to why both the alter and drop events are being fired when only the drop statement is called?
    Attached Files
Working...