How to disable trigger as soon as it got triggered.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nirmalsanjaya
    New Member
    • Sep 2008
    • 4

    #1

    How to disable trigger as soon as it got triggered.

    I want to disable a trigger as soon as it got triggered. But dont know how to do this.

    Could anyone please help me?

    Thanks,
    sanjaya
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    what is the triggering event ?

    Comment

    • nirmalsanjaya
      New Member
      • Sep 2008
      • 4

      #3
      Code:
      CREATE TABLE temp_tab1(id_         VARCHAR2(20));
      CREATE TABLE temp_tab2(table_name_ VARCHAR2(20), accessed_date_  DATE);
      
      CREATE OR REPLACE TRIGGER temp_tab1_trigger 
      BEFORE INSERT OR DELETE OR UPDATE ON temp_tab1 
      BEGIN
           DBMS_OUTPUT.put_line('Temptab1 is updated');
           INSERT INTO temp_tab2 VALUES ('temp_tab1',SYSDATE);
      END;
      /

      I want to store the update time of temp_tab1 in temp_tab2 and immediately DISABLE temp_tab1_trigg er

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        try the following link, will work in 11g

        link

        Comment

        • eeriehunk
          New Member
          • Sep 2007
          • 55

          #5
          Hi,
          Can we call a procedure that would call a disable trigger command ?
          Is is a posible solution for this question.
          If not, kindly explain?
          Regards

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            That will cause the session to hang , because you can't disable a trigger while it is still executing.

            Comment

            Working...