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. SQL to change sublibrary in z305 records gets unique constraint error

    SQL to change sublibrary in z305 records gets unique constraint error

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

    Problem Symptoms:
    SQL to change sublibrary in z305 ("PATRON?€™S LOCAL INFORMATION") records from BBBBB to AAAAA:

    SQL> UPDATE Z305
    SET Z305_REC_KEY = substr(Z305_REC_KEY,1,12) || 'AAAAA'
    where substr(Z305_REC_KEY,13,5) = 'BBBBB';

    gets unique constraint error:

    ERROR at line 1:
    ORA-00001: unique constraint (XXX50.Z305_ID) violated

    Cause:
    SQL lacks check for existing AAAAA record.

    Resolution:
    Change the SQL to the following:

    UPDATE Z305
    SET Z305_REC_KEY = substr(Z305_REC_KEY,1,12) || 'AAAAA'
    where substr(Z305_REC_KEY,13,5) = 'BBBBB'
    and substr(Z305_REC_KEY,1,12) not in
    (select substr (Z305_REC_KEY,1,12) from z305 where substr (Z305_REC_KEY,13,5) = 'AAAAA');

    Category: System Management (500)

    Subject: Oracle (500)


    • Article last edited: 10/8/2013
    View article in the Exlibris Knowledge Center
    1. Back to top
      • SQL showing number of items for each sublibrary/collection combination
      • SQL to connect course doc records with items?
    • Was this article helpful?

    Recommended articles

    1. Article type
      Topic
      Language
      English
      Product
      Aleph
    2. Tags
      1. 20
      2. contype:kba
      3. Oracle (500)
      4. Prod:Aleph
      5. System Management (500)
      6. 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