ORACLENERD
Time I've had a job (start on 04/10/2009 10:00 pm)
 
  Compound Triggers
Seriously, I don't like triggers. But if you have to maintain them, you might as well make the best of it.

While trying to figure out my problem the other day, I ran across Compound Triggers. I hadn't read about it in the 11g New Features guide, but since I don't use triggers, I wasn't sure if it was new or not. Apprently it is...

In essence, you can combine multiple triggers into one. I won't go into the gory details (because I don't know the gory details), but I will provide the example from the docs for your perusal.

CREATE TRIGGER compound_trigger
FOR UPDATE OF sal ON emp
COMPOUND TRIGGER

-- Declaration Section
-- Variables declared here have firing-statement duration.
threshold CONSTANT SIMPLE_INTEGER := 200;

BEFORE STATEMENT IS
BEGIN
...
END BEFORE STATEMENT;

BEFORE EACH ROW IS
BEGIN
...
END BEFORE EACH ROW;

AFTER EACH ROW IS
BEGIN
...
END AFTER EACH ROW;
END compound_trigger;
/
At the very minimum (if you have to use them), you might as well combine them into one and save a bit on maintenance/debugging!

Labels: , ,

 
Comments:
Good piece of information.
 
Post a Comment



Links to this post:

Create a Link



<< Home
Google


About Me || twitter/oraclenerd || View chet justice's profile on LinkedIn



Code Projects
Poor Man's Data Vault
DBA Utilities
Download Source
log4ora

How To
Parallel Processing: DBMS_JOB
Write File to Disk
Populate Time Dimension
DBMS_CRYPTO
PL/SQL: Split URL Parameters
Instrumentation: DBMS_APPLICATION_INFO

Popular
AppDev vs DataDev
Coding is Easy
Fun With Linux
Code Style Index
Better than Tom Kyte?

Previous Posts

Archives
August 2007 / September 2007 / October 2007 / November 2007 / December 2007 / January 2008 / February 2008 / March 2008 / April 2008 / May 2008 / June 2008 / July 2008 / August 2008 / September 2008 / October 2008 / November 2008 / December 2008 / January 2009 / February 2009 / March 2009 / April 2009 / May 2009 / June 2009 /



Powered by Blogger Aggregated by OraNA