Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: triggers

Re: triggers

From: Charles Hooper <hooperc2000_at_yahoo.com>
Date: 16 Nov 2006 11:55:14 -0800
Message-ID: <1163706913.969583.207300@m73g2000cwd.googlegroups.com>


Steve Howard wrote:
> schw wrote:
> > hi all,
> >
> > can one trigger be fired twice simultaneously ? I've got one trigger
> > that writes to a file and I'm worried that if the triggers is fired
> > twice simultaneously I end up with garbage in the file.
> >
> > what do you think?
> >
> > regards,
> > schw
>
> In a given session for a given operation it only fires once. If the
> table on which the trigger is based is heavily
> updated/deleted/inserted, or whatever event for which the trigger
> fires, it sounds from your description like you could have multiple
> sessions writing to your file at the same time. You can use DBMS_LOCK
> if you are writing to an external file and need to serialize access to
> it.
>
> HTH,
>
> Steve

Isn't there a possibility that a BEFORE trigger may be executed more than once, while an AFTER trigger will only be executed once? This would not be a problem for a normal transaction, but would be a problem for a transaction that is writing to an operating system file. It seems that Tom Kyte mentioned something about this in his "Expert Oracle Database Architecture" book, where there may be times when a transaction will be automatically rolled back and then reapplied - obviously Oracle will not be able to roll back the operating system file. I can't seem to find the pages in the book that mention that type of event.

Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc. Received on Thu Nov 16 2006 - 13:55:14 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US