1

I can't convert BLOB to XMLType in oracle database. I've tried this:

select
XMLType( BLOB_COLUMN,
         1 /* this is character set ID. 1 == USASCII | ISO-8859-2 char ID?*/
       ) as XML
from my_table;

I got this error message:

ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00200: could not convert from encoding US-ASCII to ISO-8859-2
Error at line 1
ORA-06512: at "SYS.XMLTYPE", line 265
ORA-06512: at line 1
31011. 00000 -  "XML parsing failed"
*Cause:    XML parser returned an error while trying to parse the document.
*Action:   Check if the document to be parsed is valid.

My question is, how to convert this BLOB (ISO-8859-2) to XMLType? What is the character ID of ISO-8859-2?

Thanks.

2 Answers 2

1

Use nls_charset_id to get ID:

select
XMLType( BLOB_COLUMN,
         nls_charset_id('ISO-8859-2')
       ) as XML
from my_table;

NLS_CHARSET_ID returns the character set ID number corresponding to character set name string.

Sign up to request clarification or add additional context in comments.

Comments

1

You can get the character set ID with nls_charset_id function.

Try this:

select
XMLType( BLOB_COLUMN,
         nls_charset_id('EE8ISO8859P2')
   ) as XML
from my_table;

1 Comment

Answered the same, 2 minutes before

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.