Is it possible to declare a variable to be used only inside of function declaration? If so - how to do it?
Variable declaration can only be placed in the prolog of a query, but you can wrap your function code with a FLWOR expression, consisting of a single LET and RETURN clause. An example:
declare function local:func() {
let $var := ...your variable...
return
...your actual code...
};
Hope this helps, Christian
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With