mardi 24 mars 2015

Pretty formatting of an XML stored in a clob in Oracle


Vote count:

0




In my Oracle database I have a table called "TestTable", with a primary key column and a column called "Message" which has the type CLOB.


Into my procedure I get an XML like this <?xml version="1.0" encoding="utf-8" ?><TestMessage><Description>This is a test message</Description></TestMessage>


My procedure looks something like this:


procedure StoreMessage(p_MessageId in raw, p_Message in clob) begin

update TestTable set Message = p_Message where MessageId = p_MessageId; end


The procedure should store the incoming XML in the clob column with proper formatting like this: <?xml version="1.0" encoding="utf-8" ?> <TestMessage> <Description>This is a test message</Description> </TestMessage>


How can I store the message as a clob, formatted properly as an XML and preserving the same encoding?


The NLS_CHARACTERSET in my database is WE8MSWIN1252 so i can't use XMLSERIALIZE which will change the encoding to WINDOWS-1252.



asked 40 secs ago







Pretty formatting of an XML stored in a clob in Oracle

Aucun commentaire:

Enregistrer un commentaire