SQL does not have a construct equivalent to XQuery's global variables. When an XQuery global variable is set to values from the database, DataDirect XQuery generally inlines the variable in the statement created for the query body.
Example 12. Global Variables
XQuery
declare variable $users := collection('USERS')/USERS;
for $u in $users
return $u/LASTNAME
Generated SQL
SELECT ALL
nrm5."LASTNAME" AS RACOL1
FROM
"PEPPINO"."USERS" nrm5
WHERE
nrm5."LASTNAME" IS NOT NULL
| Previous External Variables | Home | Next XQuery Built-in Functions |