Question

Statement Triggers vs Row Triggers.

Rating8.0Very Good

I need to know some details about statement triggers please.
For example if i have a program that issues an Update Command that creates a number of records, a row trigger will fire once PER record updated.
A Statement level trigger will fire only once per issuing statement.  So if the UPDATE actually updates 5 rows, the trigger will only fire once.
1)  Can a Statement trigger still access values like you can in a Row Trigger - ie :NEW and :OLD record values?
How can the trigger know the details of records that actually fired it?
2)  Can I go and delete records on the same table as the trigger for Statement triggers, even if it was the INSERT of this record(that I am also wanting to delete in my stored procedure called from the trigger) that fired the trigger?  Will it matter if I use a BEFORE or AFTER trigger type to do this?

Previously I've only used ROW triggers and not Statement triggers, but I now have the need to read and delete from the same table that has the trigger on it.(via a call to a stored procedure). I need to do this to avoid mutating table errors.

What I need is to have a trigger that fires on insert or update....then, depending on the value of a field of the record that fired the trigger, call the relevant stored procedure, which will go and read the same table, then delete all of the records on it, including the row that would have fired the statement trigger.

I hope this makes sense.  Any help here will be appreciated.

  1. Fire Trigger only if PK not specified
    Reference: http://www.oraclesolved.com/Q_25467881.html I have a procedure that enters data into a table. I'm going to change it so that it will also enter the NEXTVAL from a sequence. I already have a trigger that does this, and I'd like the trigger not to fire if I am passing the NEXTVAL to the table from the procedure. My trigger is…
  2. I want to create an Oracle Trigger, to fire on CR…
    I want to create an Oracle Trigger, to fire on CREATE TABLE event, that will grant privileges to the new table to 2 different roles, ADMIN and USER. The ADMIN role has "select,insert,update,delete" and the USER role would just get "select" privileges on the new table.
  3. Need a trigger to update create_ts when a new …
    I need a trigger to update create_ts when a new row is created on emp table. The primary key on emp table is emp_no, and dept_no. Thanks.
  4. Trigger code not updating table
    One of the applications I'm working with at the moment has a table used to control batch jobs. The unique index on the table is the first five columns below. This table, among other things (I've simplified the table in the example below), captures the request parameters passed to the job, the job number assigned by the system and a process status. The stat…
  5. Update Trigger firing a SELECT for INSERT statem…
    Is this trigger legal, I keep getting a statement not properly ended issue but that may not be the least of my worries. I want top insert a record into a reporting table when a record in another table is update with a score. The record that will be inserted into the reporting table will require a multi-table join but the ultimate details of the record i am inserting has to do with …

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
row statement vs after
Participating Experts
1
Solution Grade
A

Replies

 
by:

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: sbishop

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: hemlatha_rk

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert