GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Oracle  >  PL/SQL
Go To First  |  Previous Question  |  Next Question 
 PL/SQL  |  Question 147 of 237    Print  
Can we have same trigger with different names for a table?

eg: create trigger trig1
after insert on tab1;

and

eg: create trigger trig2
after insert on tab1;

If yes,which trigger executes first.

  
Total Answers and Comments: 5 Last Update: June 06, 2007     Asked by: joseph 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
February 08, 2007 00:35:02   #1  
bibin        

RE: Can we have same trigger with different names for ...
Yes you can have . This is because the triggers dont share the same namespace for tables.whereas funtions,procedures,tables etc share the same namespace.so they cant have the same name
 
Is this answer useful? Yes | No
February 09, 2007 17:03:45   #2  
geetha24 Member Since: March 2006   Contribution: 27    

RE: Can we have same trigger with different names for ...
Yes you can have..but you cannot predict the order of the execution.
 
Is this answer useful? Yes | No
March 07, 2007 01:46:10   #3  
Nikhil_4_Oracle        

RE: Can we have same trigger with different names for ...

Hi all,

i think the Question is ask in wrong way,

--> create trigger trig1

--> create trigger trig2

(both
are diff triggers on same table tab1)

its always possible...since oracle allows 12 triggers/table.

but if
you trying to do,

create trigger trigg1

after insert on emp


**************

create trigger trigg1

after update on emp

then There is An Error,-->"trigg1 already exits".

since Triggers are Stored objects in oracle, like u r stored procedures and functions..

Regards,

Nikhil - i-flex



 
Is this answer useful? Yes | No
May 04, 2007 03:45:28   #4  
prabha0508        

RE: Can we have same trigger with different names for ...
Yes we can create trigger on same event with different names but cannot predict which trigger is executed.

 for example:
create or replace trigger trigg1
 before delete on emp
 begin
 raise_application_error(-20001,'Delete not allowed');
 end;

 create or replace trigger trigg2
 before delete on emp
 begin
 raise_application_error(-20001,'Deletion is not allowed');
 end;

SQL>  delete from emp;
 delete from emp
             *
ERROR at line 1:
ORA-20001: Deletion is not allowed
ORA-06512: at "SCOTT.TRIGG2", line 2
ORA-04088: error during execution of trigger 'SCOTT.TRIGG2'

Prabha Sharma

 
Is this answer useful? Yes | No
June 06, 2007 05:11:59   #5  
Ritesh        

RE: Can we have same trigger with different names for ...
Hi,
The triggers will be fired on the basis of TimeStamp of their creation in Data Dictionary. The trigger with latest timestamp will be fired at last.

Ritesh

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape