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 IndexWebSphere Message Broker SupportESQL Select query

Post new topicReply to topic
ESQL Select query View previous topic :: View next topic
Author Message
Sneh4nsu
PostPosted: Fri Aug 11, 2017 3:10 am Post subject: ESQL Select query Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 12

Code:
SET env.HdrCmntDel[] = PASSTHRU('SELECT COMMENT_TYPE_CD FROM Database.INVOICE.INV_COMMENT
         WHERE CREATE_TS < ?
         AND (LAST_UPDATE_TS IS NULL OR LAST_UPDATE_TS < ?)
         AND INV_HDR_SK = ?;',
         Curr,
         Curr,
         inv_hdr_row.INV_HDR_SK);


Why it is throwing an exception 'ORA-00933: SQL command not properly ended'?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Aug 11, 2017 4:16 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17448

Why is that wrapped in [ ] ?

PASSTHRU statements aren't parsed or handled by ESQL at all. They are simpled ... passed thru to the database directly.

And since you're.getting an Oracle Error, then this shows that. Also it shows you where to look for error information.

You should use some kind of Oracle SQL testing tool to make sure your statement works in SQL, and then move it to IIB.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Aug 11, 2017 4:46 am Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19424
Location: LI,NY

mqjeff wrote:
Why is that wrapped in [ ] ?

I think he meant to put code tags... I fixed it that way.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Sneh4nsu
PostPosted: Fri Aug 11, 2017 4:57 am Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 12

Code:
SELECT COMMENT_TYPE_CD FROM INVOICE.INV_COMMENT
                                    WHERE CREATE_TS < CURRENT_TIMESTAMP
                                    AND (LAST_UPDATE_TS IS NULL OR LAST_UPDATE_TS < CURRENT_TIMESTAMP)
                                    AND INV_HDR_SK = 428;


i have run this code on sql developer and its working fine. i am asking whether the select statement inside passthru is correct or not??
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Aug 11, 2017 5:06 am Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19424
Location: LI,NY

Sneh4nsu wrote:
Code:
SELECT COMMENT_TYPE_CD FROM INVOICE.INV_COMMENT
                                    WHERE CREATE_TS < CURRENT_TIMESTAMP
                                    AND (LAST_UPDATE_TS IS NULL OR LAST_UPDATE_TS < CURRENT_TIMESTAMP)
                                    AND INV_HDR_SK = 428;


i have run this code on sql developer and its working fine. i am asking whether the select statement inside passthru is correct or not??

Here is the crux. In order for your passthrough statement to be what you specified above you are missing a close parenthesis that got somehow misplaced at the end of your ESQL statement ...
So your piece of code should look like
Code:
 AND INV_HDR_SK = ?;'),
Notice your missing parenthesis before the comma...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Sneh4nsu
PostPosted: Fri Aug 11, 2017 5:40 am Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 12

Code:
inv_hdr_row.INV_HDR_SK);

This is basically the end of the select statement and i am supposed to close the parenthesis only after giving the values corresponding to the respective columns.
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Aug 11, 2017 6:15 am Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1583
Location: IBM Hursley, UK

The point about Passthru is that you should put the same query into Passthru as you put into sql developer (or any other db tool), apart from the changing of values into parameter markers ('?'). In your case there is a difference which is the use of "Database." in the FROM clause. This should never be used in a passthru query, only in native ESQL. So remove "Database." and try again.

Kind regards,
_________________
MGK
IBM Global Blockchain Enablement
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Aug 11, 2017 9:13 pm Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19424
Location: LI,NY

Sneh4nsu wrote:
Code:
inv_hdr_row.INV_HDR_SK);

This is basically the end of the select statement and i am supposed to close the parenthesis only after giving the values corresponding to the respective columns.
Wouldn't your passthrough query require a values clause instead of simply putting the substituted args at the end of the select?

Like
Code:
select xzy from abc where a=? and b=? and c=? VALUES (a,b,c);

_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Sneh4nsu
PostPosted: Mon Aug 14, 2017 2:50 am Post subject: Reply with quote

Novice

Joined: 11 Aug 2017
Posts: 12

mgk wrote:
The point about Passthru is that you should put the same query into Passthru as you put into sql developer (or any other db tool), apart from the changing of values into parameter markers ('?'). In your case there is a difference which is the use of "Database." in the FROM clause. This should never be used in a passthru query, only in native ESQL. So remove "Database." and try again.

Kind regards,


Thanks buddy, it worked!!
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportESQL Select query
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.