Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Location
    Kansas City
    Posts
    1

    Post Unanswered: Help - SQL Keyword Error (SQLCODE -199)

    I continue to receive an error (SQLCODE -199) on a statement that works in other sql programs. I have looked and looked at it, it looks fine to me. Can someone please look at the following code and tell me if you see any reason for the error? Object XSROLOTV1 in library GPSMODS not found. The error I receive is below.
    Any help is appreciated. Thank you.

    ERROR -
    Object XSROLOTV1 in GPSMODS type *FILE not found.
    Object XSROLOTV1 in QTEMP type *QMQRY deleted.
    IMPORT source record length exceeds 79 characters.
    Warnings issued on IMPORT QUERY command.
    IMPORT operation completed successfully.
    Warning returned by query management.
    Keyword FROM not expected. Valid tokens: ) ,.
    RUN QUERY command failed with SQLCODE -199.
    RUN QUERY command ended due to error.
    STRQMQRY command failed.
    Function check. QWM2701 unmonitored by RUNGPSSQL at statement 13200,


    SQL -

    (INT(YEAR(DATE((DAYS(DATE(SUBSTR(CHAR(INT(LTDDAT/10000)) FROM 1 TO 4) || '-' || SUBSTR(CHAR(DEC((INT(LTDDAT/100) - INT(LTDDAT/10000)*100))/100) FROM 2 FOR 2) || '-' || SUBSTR(CHAR(DEC(LTDDAT - INT(LTDDAT/100)*100)/100) FROM 2 FOR 2) ))) - (DAYOFWEEK(DATE(SUBSTR(CHAR(INT(LTDDAT/10000)) FROM 1 FOR 4) || '-' || SUBSTR(CHAR(DEC((INT(LTDDAT/100) - INT(LTDDAT/10000)*100))/100)) FROM 2 FOR 2) || '-' || SUBSTR(CHAR(DEC(LTDDAT - INT(LTDDAT/100)*100)/100) FROM 2 FOR 2)))) + 1))) *100)

    +

    INT(WEEK(DATE((DAYS(DATE(SUBSTR(CHAR(INT(LTDDAT/10000)) FROM 1 FOR 4) || '-' || SUBSTR(CHAR(DEC((INT(LTDDAT/100) -INT(LTDDAT/10000)*100))/100) FROM 2 FOR 2 || '-' || SUBSTR(CHAR(DEC(LTDDAT - UBT(LTDDAT/100)*100)/100) FROM 2 FOR 2)))) (DAYOFWEEK(DATE(SUBSTR(CHAR(INT(LTDDAT/10000)) FROM 1 FOR 4) || '-' || SUBSTR(CHAR(DEC((INT(LTDDAT/100) - INT(LTDDAT/10000)*100))/100) FROM 2 FOR 2 || '-' || SUBSTR(CHAR(DEC(LTDDAT -INT(LTDDAT/100)*100)/100) FROM 2 FOR 2)))) + 1))) AS LTDDATYW

  2. #2
    Join Date
    Sep 2003
    Location
    Virginia, USA
    Posts
    246
    You can't pass the keyword FROM as a column alias within a SUBSTR function.

    ... SUBSTR(CHAR(DEC(LTDDAT-INT(LTDDAT/100)*100)/100) FROM 2 FOR 2)

    Isn't the syntax supposed to be SUBSTR(string, start, length). The parenthesis after 2 FOR 2 ends the SUBSTR function.

    Find the integer value, multiply by 100, subtract fro LTDDAT, convert to decimal, divide by 100, convert to character, then find a Substring within that resulting character string.

    Maybe you only need to replace FROM with a comma, and replace FOR with a comma. the rest looks good.
    MarkRem
    Author, Oracle Database 10g: From Nuts to Soup
    http://www.remidata.com/book_nuts2soup.htm

Posting Permissions

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