Subject:Update variable value inside block Author:(Deleted User) Date:13 Sep 2005 06:19 AM
Hi Marius,
the XQuery language does not allow changing the value assigned to a variable; so, in your code, you are defining a new $x variable with a narrower scope.
This is a query equivalent to the one you wrote:
declare function computeY($x)
{
if($x = 3) then 1
else 2
};
Subject:Update variable value inside block Author:Marius Enache Date:13 Sep 2005 06:27 AM
Thanks.
This helps me to understant why my code does not work. But could provide an example of how I could obtain the new value as I would from Java for example? I could return an XML node with 2 childs representing the 2 values, and then obtain the values from that node, but this would affect the performance as one of my variables is a quite large sequence.
Subject:Update variable value inside block Author:(Deleted User) Date:13 Sep 2005 06:39 AM
Hi Marius,
in XQuery you have to find out the rule or the formula that computes the correct value.
Your snippet is too simple for me to guess what you are doing; can you post the real code you are dealing with?
Subject:Update variable value inside block Author:Marius Enache Date:13 Sep 2005 07:11 AM
Thanks.
This helps me to understant why my code does not work. But could provide an example of how I could obtain the new value as I would from Java for example? I could return an XML node with 2 childs representing the 2 values, and then obtain the values from that node, but this would affect the performance as one of my variables is a quite large sequence.