ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problem using ORDER BY Clause

Post new topic  Reply to topic
 Problem using ORDER BY Clause « View previous topic :: View next topic » 
Author Message
Meow
PostPosted: Wed Dec 31, 2003 9:23 am    Post subject: Problem using ORDER BY Clause Reply with quote

Voyager

Joined: 25 Jun 2003
Posts: 95

I am having problem in using the ORDER BY Clause. I want to order the results based on a particular column in the database. This is what i am executing

EVAL('SET Environment.Variables.Query.Response[] = (SELECT T.* FROM Database."SAMPLE.EMPLOYEE" AS T '||' '||Stmt||')' );

Stmt = WHERE T.EMP_DEPT = '10' ORDER BY T.EMP_NO DESC

I am getting the follwoing error

(0x1000000)RecoverableException = (
(0x3000000)File = ''
(0x3000000)Line = 0
(0x3000000)Function = ''
(0x3000000)Type = ''
(0x3000000)Name = ''
(0x3000000)Label = ''
(0x3000000)Text = 'Expected ')''
(0x3000000)Catalog = 'WMQIv210'
(0x3000000)Severity = 3
(0x3000000)Number = 2401
(0x1000000)Insert = (
(0x3000000)Type = 2
(0x3000000)Text = '1'
)
(0x1000000)Insert = (
(0x3000000)Type = 2
(0x3000000)Text = '161'
)
(0x1000000)Insert = (
(0x3000000)Type = 5
(0x3000000)Text = ')'
)
(0x1000000)Insert = (
(0x3000000)Type = 5
(0x3000000)Text = 'integer ORDER'
)
)


Thanks
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Dec 31, 2003 9:27 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The ESQL statement "Select" does not have an ORDER BY clause, at least in 2.1.

You'll have to use PASSTHRU.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Meow
PostPosted: Wed Dec 31, 2003 9:40 am    Post subject: Reply with quote

Voyager

Joined: 25 Jun 2003
Posts: 95

i knew that but how do i sort my results then.

Please let me know. If i am using PASSTHRU it throwing me the Database undefined error.

we are having the database on mainframes and our broker has the access to those tables.

I tried these

PASSTHRU (Stmt)

where Stmt = SELECT T.* FROM SAMPLE.EMPLOYEE AS T WHERE T.EMP_DEPTNO = '10' ORDER BY T.EMP_NO DESC


this is the error

(0x1000000)DatabaseException = (
(0x3000000)File = '/build/S210_P/src/DataFlowEngine/ImbOdbc.cpp'
(0x3000000)Line = 154
(0x3000000)Function = 'ImbOdbcHandle::checkRcInner'
(0x3000000)Type = ''
(0x3000000)Name = ''
(0x3000000)Label = ''
(0x3000000)Text = 'Root SQL exception'
(0x3000000)Catalog = 'WMQIv210'
(0x3000000)Severity = 3
(0x3000000)Number = 2321
(0x1000000)Insert = (
(0x3000000)Type = 2
(0x3000000)Text = '-1'
)
(0x1000000)DatabaseException = (
(0x3000000)File = '/build/S210_P/src/DataFlowEngine/ImbOdbc.cpp'
(0x3000000)Line = 255
(0x3000000)Function = 'ImbOdbcHandle::checkRcInner'
(0x3000000)Type = ''
(0x3000000)Name = ''
(0x3000000)Label = ''
(0x3000000)Text = 'Child SQL exception'
(0x3000000)Catalog = 'WMQIv210'
(0x3000000)Severity = 3
(0x3000000)Number = 2322
(0x1000000)Insert = (
(0x3000000)Type = 5
(0x3000000)Text = '42S02'
)
(0x1000000)Insert = (
(0x3000000)Type = 2
(0x3000000)Text = '-204'
)
(0x1000000)Insert = (
(0x3000000)Type = 5
(0x3000000)Text = '[IBM][CLI Driver][DB2] SQL0204N "SAMPLE.EMPLOYEE" is an undefined name. SQLSTATE=42704
'
)
)


thanks
Back to top
View user's profile Send private message
EddieA
PostPosted: Wed Dec 31, 2003 10:07 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Looks kinda like DB2 couldn't find a table called EMPLOYEE with a schema of SAMPLE.

Also, if DESC is one of the columns coming back, shouldn't it be T.DESC.

Hint: Try the command natively at a DB2 Command Prompt to make sure it's syntactically correct, and does what you expect. And connect as the WMQI user to do this.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Meow
PostPosted: Wed Dec 31, 2003 11:27 am    Post subject: Reply with quote

Voyager

Joined: 25 Jun 2003
Posts: 95

DESC stands for Descending.

the schema and the table are present in DB2. It works fine when tried at the command prompt.

Say :

Schema name : Sample
Table name : Employee

is the passthru statement that i am using correct? WMQI Broker id has the access to that table.

My Code works fine with EVAL statement but i dont know how to incorporate the "ORDER BY" clause with the select statement as it is not supported with the select statement.

Please let me know.

Thanks
Back to top
View user's profile Send private message
EddieA
PostPosted: Wed Dec 31, 2003 1:39 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

OK, so I'm not a DB2 person.

Looks like you may have the 'Quotes' wrong/missing in you Stmt clause. Please post the EXACT statement you use to build Stmt. And the PASSTHRU.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Dec 31, 2003 2:10 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

When working with databases and WMQI, I have usually found it at least as helpful to look at the database error logs as I have the WMQI error logs.

That is, try your statement and trace it on the DB2 side to see what DB2 thinks is coming through, rather than trying to "guess" at what WMQI needs to send.

Also, don't forget that your ESQL (even the passthru) will be executed by the WMQI database userId - which may have a different idea of schemas than the user you ran the commands manually has.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
seeknee
PostPosted: Fri Jan 09, 2004 3:22 am    Post subject: Reply with quote

Apprentice

Joined: 08 Aug 2002
Posts: 41
Location: Melbourne, Australia

Have you tried somthing like this

SET Environment.Stmt[] = PASSTHRU('SELECT * FROM SAMPLE.EMPLOYEE WHERE EMP_DEPTNO = ? ORDER BY EMP_NO DESC', '10' );

We use the PASSTHRU to order our resultset and ours looks something
like this

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problem using ORDER BY Clause
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.