在Oracle中,BLOB到XMLType XML解析失败

问题描述 投票:1回答:2

我无法在oracle数据库中将BLOB转换为XMLType。我试过这个:

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

我收到此错误消息:

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.

我的问题是,如何将此BLOB(ISO-8859-2)转换为XMLType? ISO-8859-2的字符ID是什么?

谢谢。

sql oracle blob xmltype character-set
2个回答
1
投票

使用nls_charset_id获取ID:

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

NLS_CHARSET_ID返回与字符集名称字符串对应的字符集ID号。


1
投票

您可以使用nls_charset_id函数获取字符集ID。

试试这个:

select
XMLType( BLOB_COLUMN,
         nls_charset_id('EE8ISO8859P2')
   ) as XML
from my_table;
© www.soinside.com 2019 - 2024. All rights reserved.