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 error: "expression must have same datatype as corresponding expression"

    SQL error: "expression must have same datatype as corresponding expression"

    1. Last updated
    2. Save as PDF
    3. Share
      1. Share
      2. Tweet
      3. Share
    1. Additional Information
    • Article Type: General
    • Product: Aleph
    • Product Version: 21

    Problem Symptoms:
    This SQL:

    SQL> select substr(Z601_REC_KEY_3,1,9) from z601 where substr(Z601_REC_KEY_3,1,9) ^= '000000000' minus select Z103_LKR_DOC_NUMBER from z103 where Z103_LKR_LIBRARY='XXX50'

    gets the following ERROR message:

    ERROR at line 1:
    ORA-01790: expression must have same datatype as corresponding expression

    Cause:
    Z601_REC_KEY_3 is datatype Character while Z103_LKR_DOC_NUMBER is datatype NUMBER.

    Resolution:
    In the SQL change "substr (Z601_REC_KEY_3,1,9)" to "substr (to_number (Z601_REC_KEY_3,1,9))"

    Additional Information

    The SQL command "desc znnn" <where "znnn" is the table name> can be used to see the datatype of each column in a table:

    Name Type

    Z601_REC_KEY_3 CHAR(14)

    Z103_LKR_DOC_NUMBER NUMBER(9)

    Category: System Management (500)

    Subject: Oracle (500)


    • Article last edited: 12/11/2013
    View article in the Exlibris Knowledge Center
    1. Back to top
      • SQL Access to Frequency data
      • SQL FIRST / LAST functions
    • Was this article helpful?

    Recommended articles

    1. Article type
      Topic
      Language
      English
      Product
      Aleph
    2. Tags
      1. 21
      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