When I first did not know how to store the string type to the clob type, I felt very troublesome. I had to turn a lot of information online and there was not much reference value.
Fields stored in the database are of the clob type. to store the string type to the clob type, you must first convert the string type to the stream type, and then store the stream, it
In Oracle, if a column type is varchar2, it cannot be directly converted to the clob type. It can be modified indirectly. The following is an experiment:
SQL> create table test (id int, name varchar2 (10 ));
Tablecreated
SQL> insert into test values (1, 'A ');
1row inserted
SQL> insert into test values (2, 'B ');
1row inserted
SQL> commit;
Commitcomplete
SQL> select * from test;
ID NAME
---------------------------------------
1
2 B
SQL> desc test
Name
JDBC preparedstatement. setstring () and resultset. getstring () process clob and string in the same way. Although the type is changed, the program is slightly modified (front-end length verification ).
As the basic data, you need to export the table data of the development database and upgrade it in the official environment using SQL. The clob field cannot be exported normally. If the
Label:I. Distinctions and definitionsLong : variable long string data, longest 2g,long with VARCHAR2 column, can store long text up to one long column in a table Long RAW: variable Long binary data, up to 2G CLOB: character large object CLOB used to store single-byte character data NCLOB: used to store multibyte character data BLOB: used to store binary data BFILE: binary data stored in a file, the dat
The analysis of CLOB type processing in the original Broken Sword ice-oraclePrevious analysis: ORA-01461: Can only bind a long value to insert a long columnMost recently, for the Clob field, when inserting data, the number of bytes in the character (one half-width character, one byte, one full-width character, two bytes) between 2000-4000 times is wrong (ORA-01461: You can only insert a Long value assignmen
Recently in the system development need to want to insert more than 4000 bytes of Oracle database Clob field, on-line query for n long to find the following solution, it is retained for later investigation.We can be successful by creating a separate OracleCommand for the specified insert, only the data that is inserted into the CLOB type, the blob is similar, this is not described here, the following two wa
Tags: remove GRE buffer out except connect ATI Todo clob field ImportJava.io.BufferedReader;Importjava.io.IOException;ImportJava.io.Reader;ImportJava.io.StringReader;Importjava.sql.Connection;ImportJava.sql.DriverManager;Importjava.sql.PreparedStatement;ImportJava.sql.ResultSet;Importjava.sql.SQLException; ImportOracle.jdbc.OracleDriver;ImportOracle.sql.CLOB; Public classclobtest {String URL= "JDBC:ORACLE:THIN:@127.0.0.1:1521:ORCL"; String User= "His
Online a bunch of Oracle Clob Insert method, basically is to insert an empty CLOB and then find this CLOB to update, but I do not understand, the query clob is a null, how the update succeeds. I later thought of using the creation of a native Clob to do this, in the followin
I have carefully read the ibatis document over the past few days and found that after 2.2, the ibatis change is quite big. The support for custom types is also good, so that the processing of blob and clob data is much simpler.However, Spring provides good implementation, which saves a lot of effort. Next, let's look at how ibatis supports clob and blob.
Ibatis provides the typehandler interface for process
The SELECT statement can be used to search the full text of the CLOB field. However, if you must use the dbms_lob.instr () function when using the WHERE clause, the command is as follows:
First, create a TEST table:SQL> create table TEST3 (a clob, B INT, C INT );Insert data to the table:SQL> INSERT INTO TEST3 VALUES ('test clob', 11111,22222 );
1 row created.
SQL
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-base
If you have been in contact with MySQL, you must be familiar with MySQL text and Blob. in MySQL, you can directly operate on text and blob. However, in Oracle, it regards lob as a special field and cannot perform operations directly-for example, it cannot be directly inserted into the lob field or like query.
Values cannot be directly inserted into the lob field using the insert statement. Generally, there are the following steps:
1. analyze an insert statement and return a lob descriptor.
2
The SELECT statement can be used to search the full text of the clob field. However, if you must use the dbms_lob.instr () function when using the WHERE clause, the command is as follows:
First, create a test table:SQL> Create Table test3 (A clob, B INT, C INT );Insert data to the table:SQL> insert into test3 values ('test clob', 11111,22222 );
1 row created.
At the end of oracle, when you insert a clob type value to connect to Oracle in php, an error will be reported when you insert gt; 4000 characters to the clob type field in the table: the string is too long. How can we solve this problem? Can you not use the storage methods discussed? The error message "bind" is displayed. who can bind the demo code? Thank you. ------ solution ------------------ lt ;? Php
Today's test stored procedure encountered an error: ora-22922: Clob value not present.After troubleshooting, it is concluded that the Wm_concat row-to-column function is used.This function returns the varchar type in the previous version, and returns to the CLOB type in the 10.2.0.5 and 11.2.0.3 versions.It is possible to use the To_char function to convert a CLOB
At the end of oracle, when you insert a clob type value to connect to Oracle in php, an error will be reported when you insert gt; 4000 characters to the clob type field in the table: the string is too long. How can we solve this problem? Can you not use the storage methods discussed? The error message "bind" is displayed. who can bind the demo code? Thank you, oracle. finally, your value for inserting the
Inserts the Preparestatement object First (
Then be sure to set the Connection object's autocommit to False, i.e.
Conn.setautocommit (FALSE);
), the statement reads:
String sql = "INSERT into Flower_news (flower_news_id,news_content,news_author) VALUES (flower_news_id_s.nextval,empty _clob (),?) ";
Here News_content the CLOB value.
Then use the Select News_content from Folwer_news where .... Take out the record that you just inserted.
Then look at the
In the development of using struts+spring+hibernate, there are times when users have the need for a database to store files, and in a database, a BLOB field or CLOB field is typically used to store binary images, streaming media, or files. Now will be in the actual development of problems encountered and solutions to tell.first, the problem needs:1. What type of field is used in the persisted class?2. What is the data type of the file in struts?3. Wha
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.