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 130 of 237    Print  
Hi,

Can anyone tell me the difference between instead of trigger, database trigger, and schema trigger?

Thanks.

  
Total Answers and Comments: 5 Last Update: February 04, 2008     Asked by: dev 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
October 21, 2006 12:31:04   #1  
sunnyjsr Member Since: October 2006   Contribution: 6    

RE: Hi,Can anyone tell me the difference b...

INSTEAD OF Trigger control operation on view , not table. They can be used to make non-updateable views updateable and to override the behvior of view that are updateable.

Database triggers fire whenever the database startup or is shutdown, whenever a user logs on or log off, and whenever an oracle error occurs. these tigger provide a means of tracking activity in the database


 
Is this answer useful? Yes | No
October 22, 2006 04:58:31   #2  
deepak        

RE: Hi,Can anyone tell me the difference b...
Instead of trigger : A view cannot be updated , so if the user tries to update a view, then this trigger can be used , where we can write the code so that the data will be updated in the table, from which the view was created. Database trigger : this trigger will be fired when a database event ( dml operation ) occurs in the database table, like insert , update or delete. System triggers : this trigger will fire for database events like dtartup / shutdown of the server, logon / logoff of the user, and server errors ... and also for the ddl events, like alter, drop, truncate etc.
 
Is this answer useful? Yes | No
December 05, 2006 12:34:15   #3  
rampratap409 Member Since: September 2006   Contribution: 111    

RE: Hi,Can anyone tell me the difference b...

In database trigger:  Trigger for a table /view  is a database trigger

like ( before , insert  * update, delete, insert * row level, statement level)

2 * 3 * 2 = 12  + instead off trigger for views

schema triggers reffers to :  before logoff, after logon, before create, drop,alter on schema ( these trigger are also called DDL trigger)

Application trigger:  before shutdown, after startup, on error( any error occur in database, after starting the orcalce instance, before closing the instance)


 
Is this answer useful? Yes | No
December 17, 2006 14:21:22   #4  
Nasim        

Difference between instead off, database and schema trigger

Hi

if we have created a view that is based on join codition then its not possibe to apply dml operations like insert, update and delete on that view. So what we can do is we can create instead off trigger and perform dml operations on the view.

Database Vs Schema trigger:

consider these three triggers

create or replace trigger trig_usrA_conn

   after logon on schema

Begin

      insert into example.temp_table values (1,' user A connection fired');

End;

create or replace trigger trig_usrB_conn

    after logon on schema

Begin

        insert into example.temp_table values(2.'user B connection fired');

End;

create or replace trigger trig_All_conn

    after logon on database

Begin

    insert into example.temp_table values(3,' All connection fired');

End;

we have created two schema trigger for usera A and B and then created a database trigger. The Database and Schema Keywords determine the level for a given system trigger.

Now you can connect to the database as usera A and then user B and example database. The after logon trigger on the schema fires first and then after logon trigger to the database

connect userA/userA

connect userB/userB

connect example/example


 
Is this answer useful? Yes | No
February 04, 2008 18:01:36   #5  
g_sidhu Member Since: August 2007   Contribution: 122    

RE: Hi,Can anyone tell me the difference between instead of trigger, database trigger, and schema trigger?Thanks.

Triggers on system events can be defined at the database or schema level.

A trigger defined at the database level fires for all users, and a trigger defined at the schema or table level fires only when the triggering event involves that schema or table.

 

INSTEAD OF Triggers

This type of trigger is used to provide a transparent way of modifying views that cannot be modified directly through SQL DML  statements because the view is not inherently modifiable. You can write INSERT, UPDATE, and DELETE statements against the view. The INSTEAD OF trigger works invisibly in the background performing the action coded in the trigger body directly on the underlying tables.


 
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