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 » Complete noob SELECT into a variable question...

Post new topic  Reply to topic
 Complete noob SELECT into a variable question... « View previous topic :: View next topic » 
Author Message
cayenne
PostPosted: Thu Dec 21, 2006 8:54 am    Post subject: Complete noob SELECT into a variable question... Reply with quote

Newbie

Joined: 07 Dec 2006
Posts: 8

Hi all,
I'm brand new to MQ and Websphere, trying to learn as I code. I'm looking and I don't see an example in the ESQL docs or in my searches in the forum for what I'm trying to do. Should be simple...and I guess I'm missing something. I'm trying to set the value of a variable I declared to a value I'm selecting from a DB2 database.

In the editor, it says I have a syntax error...and I can't seem to find it. (I've not gotten to the part of actually running this yet.

Here's the basics:

DECLARE v_database NAME 'TESTDB';
DECLARE V_LOCATION CHARACTER;

And this line gets the syntax error:

SET V_LOCATION = (SELECT X.KEY1_FLD_VAL FROM Database.v_database.REF_TBL AS X WHERE BUSINESS_UNIT='KR828' AND MAPNAME = 'Location Lookup' AND KEY1 = InputRoot.XML.DATASET.ROWSET.RECORD[<]);

This query WILL only return one value. Can someone spot the syntax error?

Suggestions and links to info greatly appreciated!!

cayenne
Back to top
View user's profile Send private message
Edde
PostPosted: Thu Dec 21, 2006 9:15 am    Post subject: Reply with quote

Acolyte

Joined: 01 Oct 2006
Posts: 67
Location: Moscow, Russia

Read here about function THE and keyword ITEM.

Also you must use table prefix to distinguish database fields from local variables.

Code:
SET V_LOCATION =
THE (SELECT ITEM X.KEY1_FLD_VAL
FROM Database.v_database.REF_TBL AS X
WHERE X.BUSINESS_UNIT='KR828'
AND X.MAPNAME = 'Location Lookup'
AND X.KEY1 = InputRoot.XML.DATASET.ROWSET.RECORD[<]);
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 » Complete noob SELECT into a variable question...
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.