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 » Moving SQL data info ESQL flows

Post new topic  Reply to topic
 Moving SQL data info ESQL flows « View previous topic :: View next topic » 
Author Message
Gideon
PostPosted: Mon Nov 07, 2011 2:01 pm    Post subject: Moving SQL data info ESQL flows Reply with quote

Chevalier

Joined: 18 Aug 2009
Posts: 403

I am trying to retrieve a Price from a DB. The field is defined as a decimal.

I used the following code to put the output into the Local Environment:

Code:
   SET cmd = 'select price from db2inst1.catalog where pid = 1';
   --SET pid = PASSTHRU(cmd);
   SET OutputLocalEnvironment.Variables.Ret = PASSTHRU(cmd);


This returns a value of:

Code:
  (0x01000000:Name):Variables = (
    (0x01000000:Name     ):Ret             = (
      (0x03000000:NameValue):PRICE = 1.00 (DECIMAL)
    )


So I tried to do the following:

Code:
   DECLARE pid CHARACTER;

   SET cmd = 'select price from db2inst1.catalog where pid = 1';
   SET pid = PASSTHRU(cmd);

But this throws the following error:


Quote:
(0x03000000:NameValue):Text = 'Trying to assign or use a list as a scalar' (CHARACTER)


I am confused, becuase the local Environment contained the returned value of

Code:
PRICE = 1.00

How can I capture the SQL result into ESQL ?

Thanks
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Mon Nov 07, 2011 2:42 pm    Post subject: Reply with quote

Grand High Poobah

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

your problem is that you declared pid as a character whereas it should have been declared with a type of ROW.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
marko.pitkanen
PostPosted: Mon Nov 07, 2011 10:53 pm    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

Hi,

Study from InfoCenter difference between passthru and select clauses and then search "Returning a scalar value" from the same place.

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

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Moving SQL data info ESQL flows
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.