If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Create View returns error.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-25-10, 02:12
asp_crazy_guy asp_crazy_guy is offline
Registered User
 
Join Date: Mar 2009
Posts: 73
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 01:24.
Reply With Quote
  #2 (permalink)  
Old 01-25-10, 05:10
asp_crazy_guy asp_crazy_guy is offline
Registered User
 
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>.
Reply With Quote
  #3 (permalink)  
Old 01-25-10, 07:33
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
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 07:37. Reason: Added phrase "(perhaps, DB2 for LUW 9.1 or earlier)"
Reply With Quote
  #4 (permalink)  
Old 01-27-10, 01:22
asp_crazy_guy asp_crazy_guy is offline
Registered User
 
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 !
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On