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 » Asign the result of sentence SQL to variable.

Post new topic  Reply to topic
 Asign the result of sentence SQL to variable. « View previous topic :: View next topic » 
Author Message
msilva18
PostPosted: Thu Nov 25, 2004 8:41 am    Post subject: Asign the result of sentence SQL to variable. Reply with quote

Apprentice

Joined: 25 Aug 2004
Posts: 31

Hi All:

I have a problem, i need to make a global function or procedure for extract information from database and return the result. This function is used by 4 different services. The point is that I cant save this result in a variable.

My source code is:

CREATE PROCEDURE EXTRAE_INFO_ENTIDAD (
IN ENTIDAD1 CHARACTER,
OUT TERMINAL1 CHARACTER, OUT PERS_AUT1 CHARACTER,
OUT ERROR INTEGER, OUT DESC_ERROR CHARACTER,
OUT ERROR_NATIVO INTEGER)
BEGIN

DECLARE Result CHARACTER;

SET Result=
(SELECT A.D_TERMINAL AS TERM1, A.ID_PERS_AUT AS PERS1,
(SELECT B.D_TERMINAL
FROM Database.CS_ENTIDAD AS B
WHERE B.D_ENTIDAD = ENTIDAD1 AND B.B_ESTADO = '1') AS TERM2,
(SELECT C.ID_PERS_AUT
FROM Database.CS_ENTIDAD AS C
WHERE C.D_ENTIDAD = ENTIDAD2 AND C.B_ESTADO = '1') AS PERS2
FROM Database.CS_ENTIDAD AS A
WHERE A.D_ENTIDAD = ENTIDAD1 AND A.B_ESTADO = '1');

The error message when i deploy my flows is:
BIP2497E: (.EXTRAE_INFO_ENTIDAD, 31.10) : Illegal data type for target. A list field reference is required.

The expression supplying the target must evaluate to a value of a suitable type. The given expression cannot possibly do so.

Correct the logic of the ESQL program and re-deploy the message flow.


Anyone knows how can i save these results without use a message structure? I tried with CHARACTER, BIT AND BLOB datatypes for the variable and it doesnt work.

Thanks a lot.
_________________
Ing. Manuel Silva Zaldivar
Back to top
View user's profile Send private message MSN Messenger
jefflowrey
PostPosted: Thu Nov 25, 2004 9:33 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You are selecting multiple items from the database.

You are attempting to assign those multiple items into a single item.

I don't think that's even what you want to do, as you have multiple OUT parameters.

You probably want something like
Code:
 SET OutputLocalEnvironment.Variables.Result.*[] =
(SELECT A.D_TERMINAL AS TERM1, A.ID_PERS_AUT AS PERS1,
(SELECT B.D_TERMINAL
FROM Database.CS_ENTIDAD AS B
WHERE B.D_ENTIDAD = ENTIDAD1 AND B.B_ESTADO = '1') AS TERM2,
(SELECT C.ID_PERS_AUT
FROM Database.CS_ENTIDAD AS C
WHERE C.D_ENTIDAD = ENTIDAD2 AND C.B_ESTADO = '1') AS PERS2
FROM Database.CS_ENTIDAD AS A
WHERE A.D_ENTIDAD = ENTIDAD1 AND A.B_ESTADO = '1');
SET TERMINAL1 = OutputLocalEnvironment.Variables.Result.TERM1;
SET PERS_AUT1 = OutputLocalEnvironment.Variables.Result.PERS1;

etc.

Even if you got it all into a single string, perhaps by using ASBITSTREAM, you would still need to process it to remove TERMINAL1 and each of the other OUT parameters your function says it will return.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
msilva18
PostPosted: Thu Nov 25, 2004 9:54 am    Post subject: Reply with quote

Apprentice

Joined: 25 Aug 2004
Posts: 31

Hi jefflowrey:

The problem is that my function is in ESQL file in a global message flow project and I'm trying to do a simple CALL Function( parameters), but the function or the ESQL file doesnt part of the flow or my flow project. That's because this function must be called by four different flow projects. In this case if I tried to use OutputLocalEnvironment or something with the message structure it doesnt works and the broker send the error:

Identifier OutputLocalEnvironment cannot be resolved.

And thats right because there isnt a message to obtain this structure. If i had a flow and inside a compute to do this, then the OutputLocalEnvironment works, but I dont need to do this.

Do you have any idea to do this?

Thanks a lot.
_________________
Ing. Manuel Silva Zaldivar
Back to top
View user's profile Send private message MSN Messenger
jefflowrey
PostPosted: Thu Nov 25, 2004 10:31 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Ah!

Right. That is a problem...

Try using Create Field to create a tree? Maybe Create Field First Child of Result?

Otherwise, you are probably out of luck.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
msilva18
PostPosted: Thu Nov 25, 2004 10:36 am    Post subject: Reply with quote

Apprentice

Joined: 25 Aug 2004
Posts: 31

Ok. Thanks a lot. I'll try to do this and i hope it works.

Regards.
_________________
Ing. Manuel Silva Zaldivar
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Asign the result of sentence SQL to variable.
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.