SunQuest
           DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 11th, 2006, 01:44 AM
karthikgokare karthikgokare is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 7 karthikgokare User rank is Lance Corporal (50 - 100 Reputation Level)karthikgokare User rank is Lance Corporal (50 - 100 Reputation Level)karthikgokare User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 59 m 10 sec
Reputation Power: 0
Execution of Recursive Query on MainFrame DB2

Hello All,

"WITH RPL (Parent_ID, Node_ID) AS " +

"( SELECT CMM.CMM_PARENT_ID,CMM_NODE_ID FROM COMMON_HRCHY_CMM CMM " +

"WHERE CMM.CMM_NODE_ID = ? " +

"UNION ALL " +

"SELECT CH.CMM_PARENT_ID,CH.CMM_NODE_ID FROM COMMON_HRCHY_CMM CH, RPL RP " +

"WHERE CH.CMM_NODE_ID = RP.Parent_id ) select Parent_ID,Node_ID from RPL " +

"WHERE PARENT_ID='' ";


this is my query that retrieves records in hierarchial fashion .
the above query executes perfectly under windows os
but fails under mainframedb2

need help urgently

regards
karthik

The following below is the error which came up in the log file :

[3/16/06 14:44:56:907 EST] 6b038ac1 SystemOut O SQL:WITH RPL (Parent_ID, Node_ID) AS ( SELECT CMM.CMM_PARENT_ID,CMM_NODE_ID FROM COMMON_HRCHY_CMM CMM WHERE CMM.CMM_N

ODE_ID = ? UNION ALL SELECT CH.CMM_PARENT_ID,CH.CMM_NODE_ID FROM COMMON_HRCHY_CMM CH, RPL RP WHERE CH.CMM_NODE_ID = RP.Parent_id ) select Parent_ID,Node_ID from RPL WHER

E PARENT_ID=''

[3/16/06 14:44:56:978 EST] 6b038ac1 SystemOut O 2006-03-16 14:44:56,977 ERROR [ORB.thread.pool : 0] address.AddressSqlFinder (AddressSqlFinder.java:131) - [IBM][CLI D

river][DB2] SQL0104N An unexpected token "(" was found following "". Expected tokens may include: "IS <HEXSTRING> <CHARSTRING> <GRAPHSTRING> ". SQLSTATE=42601



COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2] SQL0104N An unexpected token "(" was found following "". Expected tokens may include: "IS <HEXSTRING> <CHARSTRING

> <GRAPHSTRING> ". SQLSTATE=42601

at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java(Compiled Code))

at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java(Inlined Compiled Code))

at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java(Compiled Code))

at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(DB2PreparedStatement.java(Compiled Code))

at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeQuery(DB2PreparedStatement.java(Compiled Code))

at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteQuery(WSJdbcPreparedStatement.java(Compi led Code))

at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeQuery(WSJdbcPreparedStatement.java(Compiled Code))

Reply With Quote
  #2  
Old April 12th, 2006, 09:17 AM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
I know that recursive sql wasn't introduced to os/400 until v5r4. Are you sure that your mainframe has the latest DB2 installed on it that supports this feature?
__________________
~Nemi

Before posting did you try:
[ Javadocs | Google ]

Reply With Quote
  #3  
Old April 13th, 2006, 08:13 AM
karthikgokare karthikgokare is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 7 karthikgokare User rank is Lance Corporal (50 - 100 Reputation Level)karthikgokare User rank is Lance Corporal (50 - 100 Reputation Level)karthikgokare User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 59 m 10 sec
Reputation Power: 0
version 8.1

Reply With Quote
  #4  
Old April 13th, 2006, 09:39 AM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
Sorry, that was all I had.

Maybe you could try connecting directly to DB2 on the mainframe using a DBMS client and running that query again. It may give you more insight.

Reply With Quote
  #5  
Old May 2nd, 2006, 10:59 AM
yurijsk yurijsk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 1 yurijsk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 32 sec
Reputation Power: 0
Recursive SQL-query compiling for DB2 v7.1 (OS/390)


Dear DB2 developers !

I have the same problem (error) with recursive SQL-query
compiling for DB2 v7.1 (OS/390):
...
with rpl ( level, assembly, component, quantity )
as ( select root.level, root.assembly,
root.component, root.quantity
from ykcar root
where root.assembly = 'PASSENGER COMPARTMENT'
union all
select child.level, child.assembly,
child.component, child.quantity
from rpl parent, ykcar child
where parent.component = child.assembly )

select distinct level, assembly,
component, quantity
from rpl order by level, assembly, component;
--------+---------+---------+---------+---------+---------+---------
[SIZE=1][SIZE=3]SNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL "(". SOME SYMBOLS THA
LEGAL ARE: IS <HEXSTRING> <CHARSTRING> <GRAPHSTRING>
SNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE
SNT415I SQLERRP = DSNHPARS SQL PROCEDURE DETECTING ERROR ....
....

Please, if possible, inform me about resolving this problem !!!

With kindest regards,
Yurij.

Reply With Quote
  #6  
Old May 3rd, 2006, 07:12 PM
dcaillouet's Avatar
dcaillouet dcaillouet is offline
Big Endian
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: May 2001
Location: Fly-over country
Posts: 1,173 dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 16 h 29 m 5 sec
Reputation Power: 24
The WITH clause is supported on DB2LUW (Linux, UNIX, Windows).

DB2 for iSeries or zOS do not support the WITH clause yet.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > Execution of Recursive Query on MainFrame DB2


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway