Thursday, February 16, 2012

About PL\SQL Trigger...

Hi all, I just wondering, when we should use Trigger statement and Trigger row? Because I'm not really understand in this part.
emm, where I can get complete free tutorial about this SQL Trigger?
Thanks in advance.the difference is when you insert more row in a time (tipically with a insert into ... select..)
Trigger statement is tipically faster, because is called one time, trigger row are tipically more easy to write because you have to manage only a row a time.
Trigger statement can be usefull also for checking a complex check that involve a set of row as a whole (for example chaecking the sum of a column must to be zero...)
pay attention that not every rdbm has both: for example, MS SQL has only the trigger statement, sqlite "for each row " only...|||You mention PL/SQL, so you are talking about Oracle triggers. See the free online documentation here:

Application Developer's Guide (http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg13trg.htm#376)

Concepts (http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/c18trigs.htm#12312)|||Regarding your first question:

Statement-level triggers fire once only per statement, and cannot refer to specific row values using :OLD and :NEW
Row-level triggers fire once per row affected by the statement, and can refer to specific row values using :OLD and :NEW

No comments:

Post a Comment