How to batch process in Oracle by the specified number of bars

Source: Internet
Author: User
Tags rowcount

Example

--Submit once for each processing of 10,000 articles

Loop

INSERT INTO T2

SELECT * from t1 where rownum <= 10000; --Insert 10,000 bars at a time

Delete from T1 where rownum <= 10000; --Delete 10,000 bars at a time

V_rowcount: = Sql%rowcount;

Commit

Exit when V_rowcount < 10000; --If the number of submissions is less than 10000, the description is last processed

End Loop;

Additional sql% four description of properties

The Sql%notfound--update,delete operation did not find a record that met the criteria.

Sql%found--select columnname into, Update,delete find the top of the record that matches the condition

Sql%rowcount--Determine the number of current update records

Sql%isopen--Determines whether the current cursor is open

This article is from "Richard's notes-accumulate micro Cheng" blog, please be sure to keep this source http://zxf261.blog.51cto.com/701797/751314

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/

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.