Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    73

    Unanswered: Create View returns error.

    Hi I have been trying to create a view on ISeries DB2. The following view statement is working perfectly on db2 LUW and I exported this via db2move.

    I get error Message: [SQL0104] Token <END-OF-STATEMENT> was not valid.

    Code:
    query removed
    Last edited by asp_crazy_guy; 01-27-10 at 02:24.

  2. #2
    Join Date
    Mar 2009
    Posts
    73
    The detailed error is this. I know this is a syntax error but what about it ? I double checked spaces and the terminators. Is the terminator ";" needed for every subquery ?

    Token <END-OF-STATEMENT> was not valid. Valid tokens: AS IN OUT <IDENTIFIER>.

  3. #3
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Add "AS s" at end of the statement, like this...
    where a.genfortreatysrno=b.genfortreatysrno ORDER BY a.GENFORTREATYSRNO,a.GENLAYERSSRNO) AS s;

    (It was required older DB2 for LUW(perhaps, DB2 for LUW 9.1 or earlier), too.)

    Are you using what version/release of DB2 for iSeries?
    I guessed that you are using DB2 for iSeries V6R1.
    But, if you are using DB2 for iSeries V5R4, it might not support ORDER bY in a sub-query.
    Last edited by tonkuma; 01-25-10 at 08:37. Reason: Added phrase "(perhaps, DB2 for LUW 9.1 or earlier)"

  4. #4
    Join Date
    Mar 2009
    Posts
    73

    Smile Thanks!

    Thanks for the reply Tonkuma ! Hope you are doing good. We are using V5 R4 I5 OS. The query is working from the tip you gave, previously I had to remove the order by to run it. Thanks once again !

Posting Permissions

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