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

Last updated on FEBRUARY 08, 2017

Applies to:

Oracle Server - Enterprise Edition - Version: 9.2.0.1 to 10.2.0.1 - Release: 9.2 to 10.2
Information in this document applies to any platform.
Checked for Relevance on 30-Aug-2010

Symptoms

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,
ie.

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"?>
<ROWSET>
<ROW>
<CHR_x0028_0_x0029_> 29_>
</ROW>
</ROWSET>

Output below generated when NLS_LANG set to other than UTF8 :

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


Cause

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