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.
None
0 Points
2 Posts
Insert Long String Into CLOB Field Using C#
Apr 28, 2020 01:04 PM|sjnet1|LINK
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,
Participant
1660 Points
952 Posts
Re: Insert Long String Into CLOB Field Using C#
Apr 29, 2020 04:47 AM|PaulTheSmith|LINK
I'm not an ORACLE person but Google is your friend.
https://www.codeproject.com/Articles/13675/Using-C-for-Inserting-CLOB-Data-in-Oracle