包含238个字符的XMLType失败

时间:2016-01-13 08:26:33

标签: oracle odp.net xmltype

使用Oracle.ManagedDataAccess 4.121.2.0产品版本“4.121.2.20141216 ODAC RELEASE 3”和产品版本“4.121.2.20150926 ODAC RELEASE 4”时,使用值为238个字符的OracleXmlType失败。如果我使用239或237个字符,它的工作正常。一开始,我认为因为我有一个特殊的角色(或/但我用'a'替换所有字符,我有相同的问题,错误信息很奇怪(对不起法国人):

  

ORA-31011:Echec d'analysis XML ORA-19202:Une erreur s'est produite   lors du traitement la fonction XML(LPX-00231:无效字符47   ('/')在名称或Nmtoken中找到)

请参阅下面的单元测试,用于重现问题:

Path.GetFullPath("")

表格创建脚本:

using(Oracle.ManagedDataAccess.Client.OracleConnection connection = new Oracle.ManagedDataAccess.Client.OracleConnection(myConnectionString))
{
    connection.Open();
    using(Oracle.ManagedDataAccess.Client.OracleTransaction transaction = connection.BeginTransaction())
    {
        try 
        {
            Oracle.ManagedDataAccess.Client.OracleCommand command = new Oracle.ManagedDataAccess.Client.OracleCommand();
            command.CommandText = "INSERT INTO MYTABLE(XML_VALUE) VALUES (:XML_VALUE)";
            command.Connection = connection;
            Oracle.ManagedDataAccess.Types.OracleXmlType xmlValue = new Oracle.ManagedDataAccess.Types.OracleXmlType(connection, "<root>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</root>");
            using(Oracle.ManagedDataAccess.Client.OracleParameter parameter = new Oracle.ManagedDataAccess.Client.OracleParameter("XML_VALUE", Oracle.ManagedDataAccess.Client.OracleDbType.XmlType, xmlValue, ParameterDirection.Input))
            {
                command.Parameters.Add(parameter);
                command.ExecuteNonQuery();
            }
        } finally {
            transaction.Rollback();
        }
    }
}

0 个答案:

没有答案