System. Data. OracleClient has a 32 K size limit when inserting large fields. Some methods of network collection are as follows (Microsoft enterprise database example ):
The transaction must begin before obtaining the temporary LOB. Otherwise, OracleDataReader cannot obtain the subsequent data.
You can also call the DBMS_LOB.CREATETEMPORARY system stored procedure and bind the LOB output parameter to open the temporary LOB in Oracle. On the client side, temporary LOB acts like a table-based LOB. For example, to update a temporary LOB, it must be included in the transaction.
OracleConnection conn = Db. CreateConnection () as OracleConnection;
Conn. Open ();
OracleTransaction trans = conn. BeginTransaction () as OracleTransaction;
OracleCommand cmd = Db. DbProviderFactory. CreateCommand () as OracleCommand;
Try
{
Cmd. Transaction = trans;
Cmd. Connection = conn;
Cmd. CommandText = "GetTempBlob ";
// Stored procedure: GetTempBlob
// "Declare dpBlob blob; begin dbms_lob.createtemporary (dpBlob, false, 0);: tempblob: = dpBlob; end ;";
//
Cmd. Parameters. Add (new OracleParameter ("tmpBlob", OracleType. Blob). Direction = ParameterDirection. Output;
Cmd. CommandType = CommandType. StoredProcedure;
Cmd. ExecuteNonQuery ();
Using lelob tmpBlob = (using lelob) cmd. Parameters [0]. Value;
TmpBlob. BeginBatch (OracleLobOpenMode. ReadWrite );
TmpBlob. Write (bytNR, 0, bytNR. Length );
TmpBlob. EndBatch ();
// Execute the insert Stored Procedure
Cmd. Parameters. Clear ();
Cmd. CommandType = CommandType. StoredProcedure;
// Cmd. Transaction = trans;
Cmd. CommandText = "pkg_ManoeuvreScheme.Pro_SaveManoeuvreScheme ";
Db. AddInParameter (cmd, "v_guid", DbType. String, "1 ");
Db. AddInParameter (cmd, "v_yxfamc", DbType. String, strYXFAMC );
Db. AddInParameter (cmd, "v_dy", DbType. String, strDY );
Db. AddInParameter (cmd, "v_bxsj", DbType. DateTime, dtBXSJ );
Db. AddInParameter (cmd, "v_yxfanr", DbType. String, strYXFANR );
Db. AddInParameter (cmd, "v_pj", DbType. String, strPJ );
Db. AddInParameter (cmd, "v_bz", DbType. String, strBZ );
Db. AddInParameter (cmd, "v_wdmc", DbType. String, strWDMC );
Db. AddParameter (cmd, "v_nr", OracleType. Blob, bytNR. Length,
ParameterDirection. Input, true, 0, 0, "", DataRowVersion. Current, tmpBlob );
Int ret = cmd. ExecuteNonQuery ();
Trans. Commit ();
Return ret;
}
Catch (Exception ex)
{
Trans. Rollback ();
Logger. Error (ex );
Throw ex;
}
Finally
{
Conn. Close ();
}