简体   繁体   English

在Oracle中将BLOB转换为XMLType XML解析失败

[英]BLOB to XMLType XML parsing failed in oracle

I can't convert BLOB to XMLType in oracle database. 我无法在Oracle数据库中将BLOB转换为XMLType。 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? 我的问题是,如何将此BLOB(ISO-8859-2)转换为XMLType? What is the character ID of ISO-8859-2? ISO-8859-2的字符ID是什么?

Thanks. 谢谢。

Use nls_charset_id to get ID: 使用nls_charset_id获取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. NLS_CHARSET_ID返回与字符集名称字符串相对应的字符集ID号。

You can get the character set ID with nls_charset_id function. 您可以使用nls_charset_id函数获取字符集ID。

Try this: 尝试这个:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM