Posted: Fri Feb 18, 2005 10:02 am Post subject: compute node for database
Voyager
Joined: 10 Sep 2004 Posts: 87
Hi all,
I am using the compute node and i have the following esql code
DECLARE C CHAR;
SET C =THE(SELECT T.NAME FROM Database.DB2ADMIN.EMP AS T WHERE T.VAL='121');
SET OutputRoot.XML.Name.FirstName=C;
When i am doing this it is not working properly and going to the queue which is associated with the compute fail.
But when i do this it is working properly
SET OutputRoot.XML.N.FN=THE(SELECT T.NAME FROM Database.DB2ADMIN.EMP AS T WHERE T.VAL='786');
Your first ESQL attempts to receive the result of the SELECT into a scalar CHAR variable. However when a SELECT is used with just the THE clause, then this is not guaranteed to return a scalar variable. To guarantee that a scalar is returned the THE and ITEM clauses must be used in the SELECT. Please see the ESQL documentation for a full description of this. The second ESQL statement you wrote has a field reference on the LHS and so this can receive structures and arrays and so this would be compatible when not using either THE or ITEM or not using either of them.
Hope this helps. _________________ Regards
Craig
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