Handling DUP_VAL_ON_INDEX
Date: 1996/01/14
Message-ID: <4dcjs3$ejl_at_newsbf02.news.aol.com>#1/1
I'm a new Oracle user and I'm having trouble with a database trigger.
I've got a
SQLLoad job set up to insert rows from a flat file into an Oracle table.
There is
a Before Insert trigger on the table (FOR EACH ROW) which has several
edits
that the data must pass through before the insert takes place.
My problem is this: if the record I'm trying to load already exists in
the table
(based on unique index keys), I want to update it with the new values
(values
being loaded). I wanted to use the DUP_VAL_ON_INDEX exception to tell me
if a duplicate record existed, instead of explicitly doing a database
read.
But my before insert trigger has already executed before the actual insert
takes
place. Ditto, for an after insert trigger.
Is there a way to trap this duplicate value exception in a case such as
this where
you are not doing an explicit insert. Any suggestions?? I know I
haven't stated
my case very clearly, but I thought I would give it a shot.
Thanks.
Received on Sun Jan 14 1996 - 00:00:00 CET