Exception occurrs under the realy specific, but deterministic conditions:
* string value of parameter is MORE then 2730 characters long. Ie length 2731 fails and 2730 does not. Content of the string does not matter, only length does.
* there must be another parameter (tested numeric type) in query. When you replace parameter with constant - exceptions does not occur.
DDL:
Code: Select all
CREATE TABLE DEVART_TEST_01483
(
ID NUMBER(12,0) NOT NULL,
TEXT VARCHAR(4000 CHAR) NULL
) ;
ALTER TABLE DEVART_TEST_01483 ADD CONSTRAINT DEVART_TEST_01483_PK PRIMARY KEY (ID) ;
insert into DEVART_TEST_01483(id, text) values (1, null);
Code: Select all
String text = new String('0', 2731); //with 2730 it works just fine
using (OracleConnection conn = new OracleConnection("User ID=user;SID=sid;Host=ip_adress;password=secret;Pooling=true;Min Pool Size=1;Max Pool Size=150;Direct=true;Unicode=true;"))
{
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "UPDATE DEVART_TEST_01483 SET TEXT=:TEXT where id=:ID";
var param = cmd.Parameters.Add("TEXT", text);
param = cmd.Parameters.Add("ID", 1);
var result = cmd.ExecuteNonQuery(); //ORA:01483
}
Workaround:
when I changed
param.OracleDbType = Devart.Data.Oracle.OracleDbType.Clob when the param.Size>2730 - it mirraculously worked