System. Data. OracleClient calls the stored procedure of parameters with blob and other large fields.

Source: Internet
Author: User
Tags oracleconnection

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;

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;
Conn. Close ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.