Saturday, November 23, 2013

Creating Trigger in ENABLE/DISABLE Mode in ORACLE 11G

Starting from ORACLE 11G, we can create triggers in DISABLE mode. Prior to ORACLE 11G, the triggers we create on table by default would be in ENABLE mode.

First, create a test table

create table enable_disable_test_tab (col1 int);

Now, create table in DISABLE mode as follows:

create trigger enable_disable_test_trg
before insert on
enable_disable_test_tab
for each row
disable
begin
dbms_output.put_line ('From enable_disable_test_trg trigger ');
end;
Now, create table in ENABLE mode as follows:

create trigger enable_disable_test_after_trg
after insert on
enable_disable_test_tab
for each row
enable
begin
dbms_output.put_line ('From enable_disable_test_after_trg trigger ');
end;


Now, lets query the DBA_TRIGGERS table to query the status of triggers.

select trigger_name, trigger_type, status
 from dba_triggers
where trigger_name in ( 'ENABLE_DISABLE_TEST_TRG', 'ENABLE_DISABLE_TEST_AFTER_TRG');

output:
-------


This is how we can create triggers in ENABLE/DISABLE mode.

Use the following command to enable trigger

alter trigger ENABLE_DISABLE_TEST_TRG ENABLE

Use the following command to disable the trigger

alter trigger ENABLE_DISABLE_TEST_TRG DISABLE


For more details, Refer Here

 

11 comments:

  1. Its is very very helpful for all of us.

    weblogic tutorial

    ReplyDelete

  2. Awe! What An Blog Very Helpful and interesting Really A great center for acquiring knowledge.Very Helpful Post And Explained Very Clearly About All the things.Very Helpful. Coming To Our Self We Provide Food Service Parts .Really Thankfull For the blogger providing such a great information.Thank you. Have a Nice Day.

    ReplyDelete
  3. Really It's A Great Pleasure reading your Article,learned a lot of new things,we have to keep on updating it,Immediate Care in Chicago.By getting them into one place.Really thanks for posting.Very Thankful for the Informative Post.Really Thanks For Posting Such an Useful Information On Your Blog.

    ReplyDelete
  4. Good article. It is very useful for me to learn and understand easily USMLE Thanks for posting.

    ReplyDelete
  5. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way. T hank you so much.
    Web Designing Course in chennai
    PHP Training in Chennai
    web designing classes in chennai
    Best Web Designing Institute in Chennai
    PHP Institutes in Chennai
    PHP courses in chennai

    ReplyDelete
  6. Thanks for the information......really nice blog...

    Vijay Devarakonda Height

    ReplyDelete
  7. I am happy to find this post Very useful for me, as it contains lot of information

    sustainable-hyderabad
    Article submission sites

    ReplyDelete
  8. Excellent blog. Lots of useful information here, thanks for your effort!
    Real Estate plots in Vizag

    ReplyDelete