|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Asign the result of sentence SQL to variable. |
« View previous topic :: View next topic » |
Author |
Message
|
msilva18 |
Posted: Thu Nov 25, 2004 8:41 am Post subject: Asign the result of sentence SQL to variable. |
|
|
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 |
|
 |
jefflowrey |
Posted: Thu Nov 25, 2004 9:33 am Post subject: |
|
|
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 |
|
 |
msilva18 |
Posted: Thu Nov 25, 2004 9:54 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Thu Nov 25, 2004 10:31 am Post subject: |
|
|
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 |
|
 |
msilva18 |
Posted: Thu Nov 25, 2004 10:36 am Post subject: |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|