My Oracle Support Banner

DBMS_XMLGEN.GETXML Generates Incorrect XML Output When NLS_LANG Set To UTF8 (Doc ID 304921.1)

Last updated on MARCH 28, 2019

Applies to:

Oracle Database - Enterprise Edition - Version to [Release 9.2 to 10.2]
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Oracle Database Cloud Schema Service - Version N/A and later
Information in this document applies to any platform.
Checked for Relevance on 30-Aug-2010


When session NLS_LANG set to UTF8, and generating xml from an RDBMS table, then for NULL values in the input data, the output xml produced is invalid, with unequal tags, around the null value,

select dbms_xmlgen.getxml('select chr(0) from dual') from dual;

NB. chr(0) is 'NULL'.

.... gives invalid XML output when session NLS_LANG set to UTF8 across platforms.

<?xml version="1.0"?>
<CHR_x0028_0_x0029_> 29_>

Output below generated when NLS_LANG set to other than UTF8 :

<?xml version="1.0"?>
<CHR_x0028_0_x0029_> </CHR_x0028_0_x0029_>


To view full details, 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 a vibrant support community of peers and Oracle experts.