[xquery-talk] if statements within where clauses?

Jonathan Robie jonathan.robie at datadirect.com
Wed Jun 14 15:28:26 PDT 2006

Ooops, I forgot the "then" keyword:

   where contains($text, $keyword)
     and if ($var ='all')
             $entries//classcode = $region

But you probably caught that error ;->


Jonathan Robie wrote:
> Hi Cindy,
> XQuery allows expressions to be combined very freely, and you can 
> certainly use an if expression for conditional logic in a WHERE 
> clause, as follows:
>    ....
>    where contains($text, $keyword)
>      and if ($var ='all')
>             $entries//classcode = $region
>          else
>             true()
> I did not understand what you are trying to do well enough to know 
> exactly what the query should look like.
> Hope this helps!
> Jonathan

More information about the talk mailing list