Oracle.xml.sql.OracleXMLSQLException: Invalid Context Handle Specified

(Doc ID 1955086.1)

Last updated on DECEMBER 17, 2014

Applies to:

Oracle Database - Enterprise Edition - Version to [Release 11.2 to 12.1]
Information in this document applies to any platform.


A PL/SQL block using DBMS_XMLQuery.newContext() can fail with this error:

oracle.xml.sql.OracleXMLSQLException: Invalid
context handle specified.

when using

selTxt := 'with dual2 as (select dummy from dual) select dummy from dual2';

However the PL/SQL block works when using

selTxt := 'select dummy from dual';

Sample code:




 Upgraded to


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms