Skip to main content
ExLibris

Knowledge Assistant

BETA
 
  • Subscribe by RSS
  • Back
    Aleph

     

    Ex Libris Knowledge Center
    1. Search site
      Go back to previous article
      1. Sign in
        • Sign in
        • Forgot password
    1. Home
    2. Aleph
    3. Knowledge Articles
    4. z602_id: "cannot CREATE UNIQUE INDEX; duplicate keys found"

    z602_id: "cannot CREATE UNIQUE INDEX; duplicate keys found"

    1. Last updated
    2. Save as PDF
    3. Share
      1. Share
      2. Tweet
      3. Share
    No headers
    • Article Type: General
    • Product: Aleph
    • Product Version: 16.02

    Description:
    When you try to build the z602_id Oracle index, you get:.
    ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found. Why?

    Resolution:
    This SQL was used to locate duplicates:

    SQL> select f.Z602_REC_KEY, substr(f.Z602_SUB_LIBRARY,1,50) , substr(s.Z602_SUB_LIBRARY,1,50) from z602 f, z602 s where f.Z602_REC_KEY = s.Z602_REC_KEY and substr(f.Z602_SUB_LIBRARY,1,50) ^= substr(s.Z602_SUB_LIBRARY,1,50);

    And this to delete them (since we found that some had the ""LGMED" sublibrary, while the other in the pair lacked it).

    SQL> delete from z602 where z602_rec_key in (select z602_rec_key from z602 group by z602_rec_key having count(*) > 1) and Z602_SUB_LIBRARY not like '%MED%';

    You should back up the Z602 table with p_file_03 before performing any such delete.


    • Article last edited: 10/8/2013
    View article in the Exlibris Knowledge Center
    1. Back to top
      • z601 Transfers
      • Z63_TIME, Z64_TIME, Z65_TIME
    • Was this article helpful?

    Recommended articles

    1. Article type
      Topic
      Language
      English
      Product
      Aleph
    2. Tags
      1. 16.02
      2. contype:kba
      3. Prod:Aleph
      4. Type:General
    1. © Copyright 2025 Ex Libris Knowledge Center
    2. Powered by CXone Expert ®
    • Term of Use
    • Privacy Policy
    • Contact Us
    2025 Ex Libris. All rights reserved