Skip to content

Obviate.io

To anticipate and prevent

  • Home
  • About Us
  • History
  • Privacy Policy
  • Toggle search form

DB2 LUW vs zOS: Selecting from nested subselect

Posted on 2010-02-17 By John No Comments on DB2 LUW vs zOS: Selecting from nested subselect

SQL0104N An unexpected token “” was found following “”. Expected tokens may include: “CORRELATION NAME”. SQLSTATE=42601

This was the error that I got while attempting to execute a stored procedure under DB2 v8.1 for z/OS. Being quite confused about it, I googled for the answer. I didn’t find one, but I did find this google groups post which made mention of it.

Basically, the situation was that I had

SELECT COUNT(*) FROM

(

SELECT …

UNION

SELECT …

)

And while that works just fine under LUW, z/OS doesn’t like it. The simple solution is to add “AS TBL_1”, or any other name to the parenthetical subselect, which I have done below. Both commands work just fine in LUW, but if you are working under z/OS (or at least version 8.1) you will need to use the bottom example.

SELECT COUNT(*) FROM

(

SELECT …

UNION

SELECT …

) AS TBL_1

Database Tags:db2, luw, zos

Post navigation

Previous Post: Recipe: Brett’s Kit Kat Ice Cream Pie
Next Post: I hate people; they make me sick

More Related Articles

Error: SQL1159 Initialization error with DB2 .NET Data Provider, reason code 10, tokens 0.0.0, 9.7.0 Database
The introduction of PDNSOps2 PDNSOps

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

February 2010
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
28  
« Jan   Mar »

amazon Android anime apache apple arduino asus averatec AWS Bad Company 2 cloud DIY eee fanime fanimecon github google iPad iphone IPv6 javascript kindle linkedin linux macbook air mass effect nodejs openvpn osx php review San Francisco security tutorial Ubuntu urban garden usb video wifi windows 7 winter urban garden wordpress xbox xbox 360 XboxLIVE

Copyright © 2022 Obviate.io

Powered by PressBook Premium theme