Oracle lob field operations

Source: Internet
Author: User

Today, we have a function that requires operations on the clob field. If you encounter several problems during this period, you can solve them. Remember to avoid repeating the same mistakes in the future.

Error 1:

ORA-22920: the row containing the lob value is not locked

The cause of this problem is that for update is not added when the select lob field is output. The Oracle official documents describe this error:

Reference text code
1. ORA-22920 row containing the lob value is not locked
2.
3. cause: the row containing the lob value must be locked before updating the lob value.

4.
5. Action: Lock the row containing the lob value before updating the lob value.
ORA-22920 row containing the lob value is not locked

Cause: the row containing the lob value must be locked before updating the lob value.

Action: Lock the row containing the lob value before updating the lob value.

So I added the for update to the test and found that the error prompt changed to the following:

 

 

Error 2:
ORA-01002: Read violation order

This problem occurs because the autocommit attribute value of connection is true.

SQL code
1. Conn. setautocommit (false );
2.
3 .......
4.
5. lob operations
6.
7 ......
8.
9. Conn. Commit ();
10.
11. Conn. setautocommit (true );
Conn. setautocommit (false );

......

Lob operation

.....

Conn. Commit ();

Conn. setautocommit (true );
 

You can.

 

In addition, do not select non-Lob fields when selecting the first step. If a table has multiple lob fields, it is best to operate the table in the order of fields in the table, otherwise, an error may occur.

 

Related Article

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: info-contact@alibabacloud.com 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.