Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to create 2 unique indexes (Field1, Field2) and (Field1,

RE: How to create 2 unique indexes (Field1, Field2) and (Field1,

From: Ross Collado <Ross.Collado_at_techpac.com>
Date: Wed, 30 May 2001 19:06:39 -0700
Message-ID: <F001.00314F1E.20010530191607@fatcity.com>

Hi,

The second index failed because of dups found. You will need to check the data and correct them before creating the index. The following should tell you which ones have dupl. values and how many occured:

SELECT ACCTNO,PAYGRP,count(*) from SPY_ADHOC_PAYMENT group by ACCTNO,PAYGRP having count(*) > 1;

HTH,
Ross

> -----Original Message-----
> From: CHAN Chor Ling Catherine (CSC) [mailto:clchan_at_nie.edu.sg]
> Sent: Thursday, 31 May 2001 11:55
> To: Multiple recipients of list ORACLE-L
> Subject: How to create 2 unique indexes (Field1, Field2) and (Field1,
> Fiel
>
>
> Hi Gurus,
>
> How do I create 2 unique indexes (STDID,PAYGRP) and
> (ACCTNO,PAYGRP) on the
> same table ?
>
> I created the first index successfully but encountered the
> error "ORA-01452:
> cannot CREATE UNIQUE INDEX; duplicate keys found" when I
> tried to create the
> 2nd index.
>
> SELECT INDEX_NAME,TABLE_NAME,UNIQUENESS FROM USER_INDEXES WHERE
> TABLE_NAME='SPY_ADHOC_PAYMENT'
>
> INDEX_NAME TABLE_NAME
> UNIQUENES
> ------------------------------ ------------------------------
> ---------
> U_SPYADH_1 SPY_ADHOC_PAYMENT UNIQUE
>
> SQL> SELECT * FROM USER_IND_COLUMNS WHERE
> TABLE_NAME='SPY_ADHOC_PAYMENT';
>
> INDEX_NAME TABLE_NAME
> COLUMN_NAME
> ------------------------------ ------------------------------
> ------------------------------
> U_SPYADH_1 SPY_ADHOC_PAYMENT STDID
> U_SPYADH_1 SPY_ADHOC_PAYMENT PAYGRP
>
> SQL> CREATE UNIQUE INDEX U_SPYADH_2 ON SPY_ADHOC_PAYMENT
> (ACCTNO,PAYGRP);
> CREATE UNIQUE INDEX U_SPYADH_2 ON SPY_ADHOC_PAYMENT (ACCTNO,PAYGRP)
> *
> ERROR at line 1:
> ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
>
> Any advice ? Thanks.
>
> Regds,
> New Bee
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: CHAN Chor Ling Catherine (CSC)
> INET: clchan_at_nie.edu.sg
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Ross Collado
  INET: Ross.Collado_at_techpac.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed May 30 2001 - 21:06:39 CDT

Original text of this message

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