Insert Long String Into CLOB Field Using C# RRS feed

  • Question

  • User-62400478 posted

    I am trying to insert a long string (more than 4000 characters) into a clob field in Oracle. But when I run the code, it gives me the error "can bind a long value only for insert into a long column". I tried converting the input to Decimal, Long, CLOB, NCLOB, NVARCHAR2 but it doesn't work. Also weird thing is when I try to insert hard coded value from the code, the code is adding that hard coded string to the parameter below it. For Example, in the following code, even though I am passing long string to "clobFieldName", in the catch, it is complaining that index out of range for "otherStringField" parameter. How can I insert string longer than 4K in a clob field ??? Please help.

    objCmd.Parameters.Add("clobFieldName", OracleDbType.Clob).Value = "LongStringMoreThan4000";

    objCmd.Parameters.Add("otherStringField", OracleDbType.NVarchar2).Value = "TEST";

    Thank you,

    Tuesday, April 28, 2020 1:04 PM

All replies