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,OracledatareaderThe following data cannot be obtained.
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.
Dbms_lob.createtemporary (lob_loc in out nocopy {blob | clob Character Set any_cs}, cache in Boolean, duration in pls_integer: = dbms_lob.session)
Create a stored procedure and assume a full-time role in the system, it is responsible for converting the big text data submitted by the user to the big field storage (I don't know if this is the case !)
Create or replace procedure proc_create_tmp_clob (p_tmp_clob out clob)IsBeginDbms_lob.createtemporary (p_tmp_clob, false, 0 );End proc_create_tmp_clob;
In this way,ProgramThe Section transmits large text or HTML text snippets to the Oracle database!
Let's take a simple example-(add product details. The product details are HTML clips)
Create a sharing method for processing big field data first. Just do the following!
Public Static Oraclelob tobyte ( Object Tmplob, String Content)
{
Try
{
Oraclelob templob = (Oraclelob) tmplob;
System. Text. Encoding ENC = System. Text. encoding. Unicode;
Byte [] B = ENC. getbytes (content );
Templob. beginbatch (oraclelobopenmode. readwrite );
Templob. Write (B, 0 , B. Length );
Templob. endbatch ();
Return Templob;
}
Catch (Exception ex)
{
Throw Ex;
}
}
Public Static Oraclelob converttolob (dataaccess Da, String Content)
{
Try
{
If (Da. OC. State = Connectionstate. Closed)
{
Da. OC. open ();
}
Oracleparameter mtemplob = New Oracleparameter ( " P_tmp_clob " , Oracletype. clob );
Mtemplob. Direction = Parameterdirection. output;
Tools. oraclehelper. executenonquery (DA. oC,
Commandtype. storedprocedure,
" Proc_create_tmp_clob " ,
Mtemplob );
If (Content = Null | Content = "" )
Return (Oraclelob) mtemplob. value;
Return Tobyte (mtemplob. Value, content );
}
Catch (Exception ex)
{
Throw Ex;
}
}
}
Oracleparameter mdesc=New oracleparameter ("p_goods_desc", oracletype. clob );
Mdesc. Value=Data. Tools. oraclelobhandler. converttolob (DA, goods.Desc. Description );