ORA-64219: invalid LOB locator encountered

让人想犯罪 __ 提交于 2021-02-11 17:17:56

问题


We migrated from oracle c12 to c19. And now we have simple test case that fails:

//arrange
string data = new string('x', 5000);
var connection = tm.GetConnection();

var createTableCmd = connection.CreateCommand(false);
createTableCmd.Text = "CREATE TABLE xx_temp (id NUMBER, text_long NCLOB, text_short NVARCHAR2(2000))";
createTableCmd.ExecuteNonQuery();

//act
var insertCmd = connection.CreateCommand(false);
insertCmd.Text = "INSERT INTO XX_TEMP (text_long) VALUES (@p1)";
var param = new OracleParameter("@p1", OracleDbType.NClob, data.Length, System.Data.ParameterDirection.Input);
param.Value = data;
insertCmd.Parameters.Add(param);
var insertResult = insertCmd.ExecuteNonQuery();

The last line fails with the error: ORA-64219: invalid LOB locator encountered

We're using Devart.Data.Oracle component. And I have no idea what is wrong.

What is interesting is that when I'm trying to connect to DB from powershell using Oracle.ManagedDataAccess.dll, I have no problems using similar code.


回答1:


Please upgrade to dotConnect for Oracle v9.11.980. The following code works with v9.11.980 and Oracle 19c:

//arrange
string data = new string('x', 5000);
var connection = new OracleConnection();
connection.ConnectionString = @"User Id=****;Password=****;Server=YOUR_HOST/YOUR_SID;Direct=true;";
connection.Open();

var createTableCmd = connection.CreateCommand();
//createTableCmd.CommandText = "DROP TABLE xx_temp";
//createTableCmd.ExecuteNonQuery();
createTableCmd.CommandText = "CREATE TABLE xx_temp (id NUMBER, text_long NCLOB, text_short NVARCHAR2(2000))";
createTableCmd.ExecuteNonQuery();

//act
var insertCmd = connection.CreateCommand();
insertCmd.CommandText = "INSERT INTO XX_TEMP (text_long) VALUES (:p1)";
var param = new OracleParameter("p1", OracleDbType.NClob, data.Length, System.Data.ParameterDirection.Input);
param.Value = data;
insertCmd.Parameters.Add(param);
var insertResult = insertCmd.ExecuteNonQuery();


来源:https://stackoverflow.com/questions/61338691/ora-64219-invalid-lob-locator-encountered

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!