Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Detecting the rowid of the row that caused a unique
I tend to work from the SQL*Plus end more than from PL/SQL. My solution to this kind of problem is:
SELECT A.rowid, A.column_name1, A.column_name2, ..., A.column_nameN
FROM table_name A, table_name B
WHERE A.rowid <> B.rowid
AND A.column_name1 = B.column_name1 AND A.column_name2 = B.column_name2 AND ... AND A.column_nameN = B.column_nameN
This returns the rowid and the columns involved in the unique constraint
for
the offending rows. It is then possible to delete the violating rows via
the
rowid (the fastest way to access data within Oracle). Questions? Write
me.
-- Phillip Bump pjbump_at_i1.net Mordi <mordi_at_rts.co.il> wrote in article <34D9E7EE.B355220B_at_rts.co.il>...Received on Sat Feb 07 1998 - 00:00:00 CST
> From a pl/sql program i insert into a table and when i get the ORA-00001
> unique constraint error, i need to know which rowid in the table
> caused the unique constraint error.
> Why i need the rowid is not the isue now.
> Thanks
>
>
>
![]() |
![]() |