• No replies
2 Posts

Pinned topic How to use IF sentence and validate NULL values in Xquery?

‏2012-09-02T16:49:58Z |
Hi everyone
I have the following function

declare function xf:getIbmdb2($bodyRequest as element()) as element(*) {

<ibmdb2 >

+ "<operator>eq</operator><value>{data($bodyRequest/ns0:code1)}</value>

+ "<operator>eq</operator><value>{data($bodyRequest/ns0:code2)}</value>

+ "<operator>eq</operator><value>{data($bodyRequest/ns0:code3)}</value>

+ "<operator>eq</operator><value>{data($bodyRequest/ns0:code4)}</value>

declare variable $bodyRequest as element() external;
I have the following questions

1.-How to use IF sentence in a Xquery function?
2.-How to validate NULL vales in a Xquery function?
For example...
IF ($ bodyRequest/ns0: code1)! = NULL {
<property> code1 </ property> "
+ "<operator> Eq </ operator> <value> {data ($ bodyRequest/ns0: code1)} </ value>
</ filter>
Else {}}