Posted: Thu Apr 08, 2004 4:12 pm Post subject: Help Using PASSTHRU with SELECT + THE
Novice
Joined: 19 Jan 2004 Posts: 10
Hi All,
Can anyone help me with using PASSTHRU to my situation.
My original query to a database under schema abcd45 is :
select DISTINCT MAX(Pid) from abcd45.table5;
Returns : 3
This works fine at SQL prompt.
I was implementing it in Database node as follows:
DECLARE schema1 CHAR;
DECLARE temp INT;
SET schema1 = 'abcd45';
SET temp = PASSTHRU ('SELECT DISTINCT MAX(E1.Pid) FROM ' || schema1 ||'.table5 E1');
SET Environment.variable.temp555 = temp;
------------------------------
And I am trying to see the value of temp555 in the trace file. By setting
Pattern to : ${Environment.variable.temp555}
---------------------------------------------------------
The Query is working and it is ubable to assign the result (in this example 3 an integer value) to temp. saying
'Trying to assign or use a list as a scalar'
-----------------------------------------------------
How can I accommodate 'THE' in the PASSTHRU to change resulting 'list' from select statement to a 'scalar' value . In my case the result is list of single value 3.
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
Hi!
To the best of my knowledge, you can't. PASSTRHRU will *always* expect the receiving variable to be a list. So, in your case:
Code:
SET Environment.variable.temp[] = PASSTHRU ('SELECT DISTINCT MAX(E1.Pid) FROM ' || schema1 ||'.table5 E1');
SET Environment.variable.temp555 = Environment.variable.temp[1].*[1];
should do the trick. Note that temp[1] will get a child element. I'm not sure what name it will get in this case, but I'd guess something like Column0. Since you're not interested in that name, the syntax temp[1].*[1] will return the first child of temp[1], regardless of its name.
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