Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    5

    Unanswered: DB2 Error for LIKE statement

    I'm trying to run this query that I built with the query analyzer. For some reason it doesn't work. Can someone help me with this? Thanks

    Chris

    sun211d2r(fnsw)/fnsw/stress/indexora> less db2_q12.sql.net
    SELECT DOCTABA.F_DOCNUMBER
    FROM F_SW.DOCTABA AS DOCTABA
    WHERE DOCTABA.A33 LIKE '3.0.0%'
    ORDER BY DOCTABA.F_DOCNUMBER ASC;


    sun211d2r(fnsw)/fnsw/stress/indexora> db2 -tvf chris.sql
    SELECT DOCTABA.F_DOCNUMBER FROM F_SW.DOCTABA AS DOCTABA WHERE DOCTABA.A33 LIKE '3.0.0%' ORDER BY DOCTABA.F_DOCNUMBER ASC
    SQL0440N No authorized routine named "LIKE" of type "FUNCTION" having
    compatible arguments was found. SQLSTATE=42884

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    What is the data type for A33?
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Actually I think you are using the table function (AS) incorrectly, even when it is not needed. Try this:

    SELECT F_DOCNUMBER
    FROM F_SW.DOCTABA
    WHERE A33 LIKE '3.0.0%'
    ORDER BY F_DOCNUMBER ASC;
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  4. #4
    Join Date
    Mar 2004
    Posts
    5
    Originally posted by Marcus_A
    What is the data type for A33?

    A33 happens to be a VARCHAR datatype.

  5. #5
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Originally posted by chris58950
    SELECT DOCTABA.F_DOCNUMBER
    FROM F_SW.DOCTABA AS DOCTABA
    WHERE DOCTABA.A33 LIKE '3.0.0%'
    ORDER BY DOCTABA.F_DOCNUMBER ASC;

    A33 happens to be a VARCHAR datatype.
    I vaguely remember something about the single quote being a problem if it's the last character in a line... Can you try rearranging your statement in the script file, something like:

    SELECT DOCTABA.F_DOCNUMBER
    FROM F_SW.DOCTABA AS DOCTABA
    WHERE DOCTABA.A33 LIKE '3.0.0%' ORDER BY
    DOCTABA.F_DOCNUMBER ASC;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •