I am using Simple.Data.Oracle to insert data in a table. I am trying to insert a very large value in one of the columns and it is giving me the following error
ORA-22835:Buffer er for lille til konvertering af CLOB til CHAR eller BLOB til RAW (faktisk: 19471, maksimum: 4000)
I am a long way ahead in the project and can't afford to dump Simple.Data.Oracle and look for other alternates at the moment...
You're converting a CLOB to a string of some description. There's a maximum of 4,000 characters in a string in SQL so you need to take a sub-string of the CLOB if you want to place it into a character.
The simplest way to do this is to use DBMS_LOB.SUBSTR
.
It doesn't appear as though simple.data.oracle
supports CLOBs natively; if you look at the code for the DBTypeConverter
class the dictionary maps a CLOB to DBType.String
:
{"CLOB", DbType.String},
This is despite the documentation linked in the comments indicating that it should be mapped to DBType.Object
. Though the mappings have changed very slightly in the 11.2 documentation a CLOB is still an object.
I don't know the reasons for deciding that a CLOB is a string but as I see it you have a few options:
DBMS_LOB.SUBSTR
and "chunk" the CLOB into as many strings as are required using the offset parameter.