Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

There is a large table. Because there is a vacancy at the time of entry, the vacancy will now be given a date.

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. The table is very large, 8t, by three columns, of which create_time is now required to be modified to a non-null value. Because of the large amount of data, it is increased in batches.

The script is as follows

Create or replace procedure PRC_UPDATE_CREATE_TIME is

Start_num integer

Start_date date

Total number

Update_count integer

Per_loop_count integer

Begin

Dbms_output.put_line ('Start to batch update')

Start_num: = 1;-- start value of cycle

Per_loop_count: = 100;-- per cycle handle count

Start_date: = to_date ('20100101,' YYYYMMDD');-- start date of create_time

/ get total number of the update records /

Select count (1) into total from tmp_loan_file_data

Where CREATE_TIME is null

Dbms_output.put_line ('total number:')

Dbms_output.put_line (total)

Update_count: = total/per_loop_count

If (mod (total, per_loop_count) > 0) then

Update_count: = update_count + 1

End if

Dbms_output.put_line ('loop times:')

Dbms_output.put_line (update_count)

/ Loop to update records /

While start_num = 1

And rownum

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report