ChiBella
asked on
Oracle 9i Insert into Clob > 4000 Bytes
Need to insert more than 4000 of data into an Oracle Clob column. I notice the size on the clob column is 4000 by default. I'm using Oracle 9i.
We are using .net/c#. How do we insert more than 4k bytes in a clob field (Oracle 9i)?
We are using .net/c#. How do we insert more than 4k bytes in a clob field (Oracle 9i)?
ASKER
Are you sending parameter to a stored procedure? How do we do this without a stored procedure..using an insert sql or update sql?
I use bind parameters for all DB invocations. Build your insert statement like this:
"INSERT INTO mytable VALUES( :1, :2)"
Then add two bind parameters, one for the key and one for the clob to the parameter collection of the OracleCommand object.
Bind parameters make your code run faster because it can avoid hard parses on the DB server.
"INSERT INTO mytable VALUES( :1, :2)"
Then add two bind parameters, one for the key and one for the clob to the parameter collection of the OracleCommand object.
Bind parameters make your code run faster because it can avoid hard parses on the DB server.
ASKER
I see ...
So the insert value can be greater than 4000 bytes?
How about an update > 4000 bytes?
So the insert value can be greater than 4000 bytes?
How about an update > 4000 bytes?
Same thing. CLOB size is a huge number (don't remember the exact limit, but 3 GB rings a bell).
ASKER
Everywhere I look states there is a limit to the amount you can pass directly (4k) and you have to do it in chunks. We will try your method and let you know.
thanks
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OracleParameter OracleParam = new OracleParameter();
OracleParam.OracleDbType=O
OracleParam.Value = yourNewValue;
OracleParam.ParameterName = name;
// DO NOT set the size! OracleParam.Size = length;
OracleParam.Direction = ParameterDirection.Input;
This has worked for me in both 9i and 10g.
Jim