XML Database (MOSC)

MOSC Banner

if the column is null, xmlsequence will not generate the tag. But need to generate the empty tag.

edited Apr 16, 2012 9:49PM in XML Database (MOSC) 3 commentsAnswered
Hi,

I'm working a SQL to generate the XML in a relational db using xmlsequence. Here is the test case:

create a relational table and insert a record:

create table ken_test
(col1 varchar2(10)
,col2 varchar2(10)
,col3 varchar2(10)
);

Insert Into ken_test
(col1) Values ('ok to create');

Then using the following to generate XML:

Select Value(h)
From Table(xmlsequence(Cursor (Select * From ken_test),xmlformat('test'))) h;

The result wll be:
<test>
<COL1>ok to create</COL1>
</test>

and the columns COL2 and COL3 are omitted since they are null.

How can I geneate the tags for all columns even if they are in null values?

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

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

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center