Oracle data migration to History table data ———— procedure

Source: Internet
Author: User

Create or replace procedure Remove_refund_his_pro is
Begin
Declare
Cursor Refund_query_cur is
Select rowID from Ucmp_realtime_refund_query t1
where t1.apply_tm<= TRUNC (Add_months (Sysdate,-3), ' DD ') and ROWNUM <= ' 100000000 ';
TYPE Rowid_table_type is table of ROWID index by Pls_integer;
V_rowid Rowid_table_type;
Begin
Open refund_query_cur;
Loop
Fetch refund_query_cur Bulk collect into V_rowid limit 100000;
Exit when v_rowid.count=0;
ForAll i in V_rowid.first. V_rowid.last
INSERT into His_realtime_refund_query
(SELECT * from Ucmp_realtime_refund_query
WHERE rowID = V_rowid (i));
ForAll J in V_rowid.first. V_rowid.last
DELETE from Ucmp_realtime_refund_query
WHERE rowID = V_rowid (j);
Commit
End Loop;
Close refund_query_cur;
End
End Remove_refund_his_pro;

Oracle data migration to History table data ———— procedure

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.