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: Oracle 10 + Sun App Server 7: Unique Constraint Violation?!?

Re: Oracle 10 + Sun App Server 7: Unique Constraint Violation?!?

From: EdStevens <quetico_man_at_yahoo.com>
Date: 15 Nov 2006 05:36:06 -0800
Message-ID: <1163597766.384225.194670@h54g2000cwb.googlegroups.com>

ndamianov wrote:
> Hi All,
>
> For about a week and a half I have been trying to solve a mysterious
> issue with unique constraint violations on our database server without
> any luck.
>
> We basically have a simple table with a unique primary key (number) and
> a few string columns that aren't part of the key.
>
> With J2EE on the Sun App Server 7, we always make sure we get the
> nextval from the table's sequence before inserting it into the table. I
> have checked this numerous times.
>
> The Oracle DB doesn't have any triggers or other procedures accessing
> the table in any way.
>
> >From time to time, we get a bunch of unique constraint key violations
> in spaces of about 30 minutes after which its all good again...
>
> Has anybody heard of this issue or know how to fix it?
>
> Regards,
>
> Nikk

This would be an application issue. You need to find out what the app is doing "in spaces of about 30 minutes." The fact that "From time to time, we get a bunch of unique constraint key violations" suggests to me that there is some sort of batch process that should be investigated?

Also note, you don't need to get the sequence before doing the insert. You can get it at the insert statement itself:

INSERT INTO employees

   VALUES (employees_seq.nextval, . . . ); Received on Wed Nov 15 2006 - 07:36:06 CST

Original text of this message

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