Re: Before Insert trigger conflict

From: Stephen_CA <stephen.bell_at_sympatico.ca>
Date: 26 Jun 2003 07:02:50 -0700
Message-ID: <5aeee507.0306260602.6d7b96c4_at_posting.google.com>


That's right..it absolutely doesn't compute..here's the results of some further investigation:

The max sequence number already in the table is 44 and the nextval of the sequence is 84..no conflict there

If we insert a record through a different interface (TOAD in this case) it increments properly and inserts.

If we move the trigger to the form (disable it in the database) it also works.

Even if two triggers were firing for example we'd just end up with two nextvals
so it would still insert.

[Quoted] The exact error they're getting is FRM-4600 "Record has already been inserted"..if I had to describe the symptom, I'd say it acts as though the
form is trying to commit the same record twice!  

andrewst <member14183_at_dbforums.com> wrote in message news:<3041694.1056553090_at_dbforums.com>...
> Originally posted by Stephen_ca
> > Hi all,
> >
> > version: Forms 6.0.8.1.9.2
> > Oracle 8.1.7.3
> > Windows 2000
> >
> > Our database has some tables where the Primary Key is generated
> > through a
> > sequence and inserted with a BEFORE INSERT trigger.
> >
> > My developers are telling me now that when they insert through a form
> > that this
> > trigger is not functioning correctly, that they're getting a
> > "duplicate value on
> > primary key" error. They say we have to disable the triggers in the
> > database and
> > insert the PK value through a forms trigger.
> >
> > The problem is that inserts to the database will not occur only
> > through the forms interface so obviously, without the database
> > trigger, the PK value will not be inserted.
> > According to one of them, this is a standard forms problem, but I find
> > that hard to believe.
> >
> > Any thoughts are much appreciated and thank you in advance,
> >
> > Steve
> Does not compute. If you can a primary key violation, it is because you
> tried to insert a PK value that was already there. Doesn't matter
> whether you created the value in a database trigger or a Forms trigger.
> The issue appears to be that either there is a bug in your trigger, or
> the table already has rows with PK values that are higher than the
> current sequence value. Either way, moving the logic from the database
> trigger to the form will not help.
Received on Thu Jun 26 2003 - 16:02:50 CEST

Original text of this message