1, my database is oracle11g encountered the field is CLOB type, but what is required is a string type, write a conversion function can solve the problem.//clob type turn string PublicString clobtostring (Clob Clob)throwsSQLException, IOException {String restring= ""; Reader is=Clob.getcharacterstream (); BufferedRe
In the application of data insertion through a group of SQL statements, we are likely to encounter situations where we need to insert large data, for example, when we need to insert a field with more than 4000 bytes in Oracle, if we implement the insert through a simple set of SQL statements, there is obviously a problem, and in SQL The server does not have this restriction, the individual tried the 26w-character SQL statement in the SQL server2005 execution, can still insert data, but the inser
[Cpp]Read// P_rs is resultsetIf (p_rs-> next ()){Clob clob = p_rs-> getClob (4 );If (! Clob. isNull ()){// Clob. setCharSetForm (OCCI_SQLCS_IMPLICIT); // The local encoding format seems to be incorrect.Clob. setCharSetId ("UTF8"); // The database is stored in UTF-8Unsigned int cloblen =
(1) The types of corresponding clob,blob in different databases:In MySQL: Clob corresponds to a text blob corresponding to a blobcorresponding blob in CLOB corresponding Clob blob in db2/oracle(2) corresponding type in domain:CLOB corresponding String blob corresponding to byte[]Cl
[Author]: KwuSqoop handles Clob and Blob fields, Clob as large text in Oracle. The blob stores the binary file. This type of field is encountered when importing hive or HDFS requires special handling.1. measured frequently in OracleCREATE TABLE t_lob ( A INTEGER, B CLOB, C BLOB )Test dataInsert into T_lob (A, B, C) VALUES (1, '
[Author]: KwuSqoop handles Clob and Blob fields, Clob is large text in Oracle, andblobs store binary files. This type of field is encountered when importing hive or HDFS requires special handling. 1. Test Tables in OracleCREATE TABLE t_lob ( A INTEGER, B CLOB, C BLOB )Test dataInsert into T_lob (A, B, C) VALUES (1, '
In pl/SQL tools, you need to change the value of a field in a line:
Method 1.
Repeat the table to edit the data.
In this way, you can see the data you want to change at a glance when the data volume is small.
However, when the data volume is large, the update statement is required.
If you update a clob-type data, for example, the following allcode field is clob-type.
Update... set allcode = '.......'
In Pojo, a large object in a string can be declared as a java.lang.String or Java.sql.Clob type.When the program loads the CLOB type data from the database, only a logical pointer to the CLOB type of data is loaded. We need to get the data input stream of the CLOB type by using the Clob.getcaracterstream () method before we can get the large object data.Look at t
Two: Solve by To_clob and Dbms_lob
The basic idea is to convert the VARCHAR2 to CLOB, and then convert the Clob to a blob.
Next is the procedure, the function used will be given in the following: (Write 2 function:c2b v2b, the function is to change the clob into a blob, the VARCHAR2 will be a blob)
table Techinfoa Conversion, with a functionc2bA
Some data is used for testing, but I think the function is basically implemented. The method for inserting clob or blob is also attached. I also made some modifications on it.
Which can insert both clob and blob
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 /**/ /// 2 /// Write both clob and
There has been no time to solve the big field problem of data migration in the past few days. Today, we finally have time to solve this problem.
Scenario
When a table in the SQL Server database is migrated to the Oracle database, special field types were not considered in the early stage, but problems were found during real business application testing, the content of this field in Oracle is blank (ignored during migration ). We need to update the content in the SQL Server table to Oracle ba
While (dbset. Next () {clob = (oracleresultset) dbset). getclob (1); clob. putstring (1, questioncontent );
Or
If (RSS. Next () {clob = (clob) RSS. getclob (1); clob. putstring (1, allmobilecode );}
If the connection pool is used for insertion, an error is returned. java.
BackgroundOracle field type VARCHAR2 Maximum length 4000, what to doSolveUse CLOB type, large print segment, no length limitProblemThe CLOB type obtained by using the Java JDBC Read RS is not working properly, encapsulating the Rs.getobject (). If the field content is determined to be a string, how do you read the string normally? Not changing the encapsulated data acquisition method?SchemeDetection items,
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:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.