Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Balakrishna.

Asked: August 03, 2016 - 1:33 am UTC

Last updated: August 03, 2016 - 1:12 pm UTC

Version: 12c

Viewed 1000+ times

You Asked

HI TOM,

Which will fire default first statement level or row level trigger?

and Connor said...

Statement first.

The hierarchy would be:

before-statement
before-each-row
after-each-row
after-statement

If you have lots of triggers defined at each of these levels, then the order in which they fire is indeterminate (ie, "random") unless you use the FOLLOWS clause to choose the order you want.

Hope this helps.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, August 03, 2016 - 10:41 am UTC

Why after-statement is a last not before after each row?
Chris Saxon
August 03, 2016 - 1:12 pm UTC

A statement hasn't completed until it's processed all the rows! So if you have rows 1-3, the after row trigger will fire:

After row 1
After row 2
After row 3

The statement has not finished. So the after statement trigger can fire

http://docs.oracle.com/database/121/LNPLS/triggers.htm#LNPLS99985

Chris

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library