Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-00001 uniqueness error yet no apparent violation in the data

487397Jul 17 2007 — edited Jul 25 2007
I have a simple insert statement that generates an ORA-00001 error on the primary key. There are no other unique constraints on the table. The SQL statement is basic:

insert into X
query;

Fortunately, the result set is small enough that I can just examine it brute force. But, when I run the query alone, the result set does not reveal any obvious uniqueness errors. (And yes, I've checked to see if the data is in the table before I ran the insert).

So, I converted the insert statement to a PL/SQL block with a cursor loop:

declare

cursor cX is query;

for rec in cX loop
insert into X values (rec.values);
end loop;

exception
when others output sqlerrm
end;

Yet, when I run this cursor loop, there is no exception raised! (and all the data inserts successfully with no errors).

So, I suppose I should be satisfied that the cursor loop works, yet it disturbs me that this "nonexistent" uniqueness error occurred to begin with.

Any idea why this could be happening?

Thanx in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2007
Added on Jul 17 2007
15 comments
1,313 views