Re: Multiple triggers on the same table

From: Tim X <timx_at_spamto.devnul.com>
Date: 08 Feb 2003 14:39:18 +1100
Message-ID: <87ptq3saop.fsf_at_tiger.rapttech.com.au>


>>>>> "Siotos" == Siotos Evaggelos <sevag_at_eurodyn.com> writes:

 Siotos> First of all, thank you for your time. :)

 Siotos> Sybrand Bakker wrote:

 >>

>> Of course: the Oracle Application Developers Manual states that
>> Oracle doesn't guarantee the sequence of triggers. Your statement
>> about not knowing whether triggers exist is void: you can easily
>> look that up in user_|all_|dba_triggers.
 Siotos> Things aren't so simple. I don't have access to the database
 Siotos> I am referring to, so I cannot have any view of the existing
 Siotos> triggers and definately, I cannot merge any triggers. I am
 Siotos> working on the production database and all the changes will
 Siotos> be applied on the dissemination database and those databases
 Siotos> are geographically separated (periodically synchronised by
 Siotos> sending sql files). Above that, I would like a more general
 Siotos> solution so that it can be applicable to other databases too.
 Siotos> Till now, I have made my triggers not to cause any troubles
 Siotos> to other existing triggers. But, in the case that an existing
 Siotos> trigger is been executed before and it deletes the row, I
 Siotos> will face some problems.  That's why I wanted to force the
 Siotos> execution of my trigger first.

I don't think you have a problem here. First of all, the trigger is not going to delete a row - an on delete trigger is going to fire because the row is being deleted, not to delete. Besides, if you had a trigger which tried to do this, wouldn't you hit the mutating table problem?

Apart from all of the above, you also have the inserting, updating and deleting tests which you can use in your trigger to determine what is happening to the row.

Possibly the only real problem you would have is if you are going to modify a column that also gets modified by a trigger which runs after your trigger. this could result in your modification being lost.

I have to say, I'm a bit amazed you are writing triggers for databases you don't have access to and from what you imply don't have clones of for testing etc. No matter how careful you are, there is bound to be problems.

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!
Received on Sat Feb 08 2003 - 04:39:18 CET

Original text of this message