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
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
Nice Post... Oracle Training in Chennai
ReplyDeleteIts is very very helpful for all of us.
ReplyDeleteweblogic tutorial
ReplyDeleteAwe! 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.
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.
ReplyDeleteGood article. It is very useful for me to learn and understand easily USMLE Thanks for posting.
ReplyDeleteIts 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.
ReplyDeleteWeb 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
Thanks for sharing this information admin, it helps me to learn new things. Continue sharing more like this.
ReplyDeleteRPA Training in Chennai
RPA courses in Chennai
Robotic Process Automation Courses
learn Robotic Process Automation
Angularjs Training in Chennai
AWS Training in Chennai
Thanks for the information......really nice blog...
ReplyDeleteVijay Devarakonda Height
I am happy to find this post Very useful for me, as it contains lot of information
ReplyDeletesustainable-hyderabad
Article submission sites
Your post is great. RPA Training in Chennai
ReplyDeleteExcellent blog. Lots of useful information here, thanks for your effort!
ReplyDeleteReal Estate plots in Vizag