When you upgrade a WLI 8.x project to 10g Release 3 (10.1.3), by default, inline XQuery 2002 code (embedded in JPD files) is not converted to XQuery 2004. You can convert the inline XQuery code to XQuery 2004, by performing the following steps in the Source Upgrade screen of the upgrade wizard.
Figure A-1 Source Upgrade Screen of the Upgrade Wizard
Expand JPD Document Upgrader options.
Select the Upgrade XQ2002 to XQ2004 check box, as shown in the following figure.
Figure A-2 Upgrade XQ2002 to XQ2004
Continue with the application upgrade process.
When the upgrade process is completed, XQuery 2002-compliant code that is embedded in JPD files (inline XQuery code) is converted to XQuery 2004.
Upgrading XQuery Files
XQuery 2002-compliant XQuery files (unlike inline XQuery code) are not converted automatically to XQuery 2004 during the application upgrade process.
You can upgrade XQuery 2002-compliant XQuery files to XQuery 2004 by right-clicking the XQuery file in the Navigator view in Workshop and choosing Upgrade to XQuery 2004. However, the following XQuery constructs and functions are not converted to XQuery 2004:
Constructs for which the syntax has changed in XQuery 2004:
Table A-1 Constructs For Which the Syntax Has Changed in XQuery 2004
In some cases, merely changing the syntax might not give correct results.
The syntax and parameter type have changed. In the XQuery 2004 syntax, the operation is addition regardless of the sign of the parameter. In XQuery 2004, the operation depends on the sign of the parameter.
The parameter type and return type might be different.
for $i in ….
There is no direct replacement for foreach. The construct must be rewritten by using a for loop.
some $x in (1, 2, 3), xs:integer $y in (2, 3, 4)
some $x in (1,2,3),$y in (2,3,4)
Existence of the optional type declaration makes it difficult to reliably convert this construct.
every $x in (1, 2, 3), xs:integer $y in (2, 3, 4)
every $x in (1,2,3), $y in (2,3,4)
Functions for which the semantics have changed in XQuery 2004:
Table A-2 Functions For Which Parameter Types and Order Have Changed in XQuery 2004
xf:resolve-uri(anyURI $base, anyURI $relative)
fn:resolve-uri($relative as xs:string?, $base as xs:string)
xf:distinct-values(item* $srcval) => item*
fn:distinct-values ($arg as xdt:anyAtomicType*) as xdt:anyAtomicType*
Constructs for which the casting rule has changed: eq, ne, lt, gt, le, and ge.
Functions for which the return type has changed in XQuery 2004
Most time/date-related functions and operators
Queries containing sortby
Function not supported in XQuery 2004: julianDay-from-date
During the upgrade process, XQuery 2002 constructs and functions that are not supported by XQuery 2004 are flagged with comment entries indicated by “: Warning :” in the code. In addition, a warning message is displayed during the upgrade process, informing you that unsupported constructs and functions were encountered.
After the upgrade process, you can identify the constructs and functions that are not upgraded to XQuery 2004 by looking for the “: Warning :” comments. You must then manually change the unsupported constructs and functions to make them comply with the XQuery 2004 standard.