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: Before Insert Trigger

Re: Before Insert Trigger

From: <jkstill_at_gmail.com>
Date: 27 Sep 2005 17:08:39 -0700
Message-ID: <1127866119.779096.101930@z14g2000cwz.googlegroups.com>

dbaplusplus_at_hotmail.com wrote:
> I have a table test. I have set up a trigger (before insert)
>
> CREATE OR REPLACE TRIGGER tr_test_row
> BEFORE INSERT ON test
> FOR EACH ROW
>
>
> There is a primary key on table test on name column. There is already a
> row in test table.
>
> When I insert a row with same name as an existing row, Oracle does not
> fire the trigger (I have put debugging statements in the trigger)
> instead it immediately sends me a message that unique constraint
> violated. Why? I was expecting that the uniqueness check will be done
> after trigger is fired (it is a before insert trigger). I have error
> catching logic in my trigger and want to capture all Oracle errors
> including unique constraint violation in the trigger. Is there a way of
> doing that?
>
> Any pointers will be appreciated. Thanks a lot.

You may wish to investigate SERVERERROR database event trigger: http://oraclesvca2.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_7004.htm#sthref5790 Received on Tue Sep 27 2005 - 19:08:39 CDT

Original text of this message

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