Re: Newbie: Double Keys

From: pconnors on BIX <pconnors_at_BIX.com>
Date: 17 Mar 95 04:39:31 GMT
Message-ID: <pconnors.795415171_at_BIX.com>


bodumag_at_dial.eunet.ch (Jesper Clausen) writes:

>Hello
 

>Try to build uniq index on a table whith "create uniq index .....",
>get the message "Double keys exist, can't build uniq index"
 

>Now, How do i find these double records in my table with Oracle SQL-Plus

Given table FOO, with unique index BAR, do the following:

select A.BAR from FOO A
where exists (select B.BAR from FOO B

              where A.BAR = B.BAR
              and   A.ROWID <> B.ROWID)

if your index is more than one column include all columns in the where clause of the subquery.

NOTE: This query can potentially take a long time.

     -Pat Connors Received on Fri Mar 17 1995 - 05:39:31 CET

Original text of this message