Get the App
SLTechnology News&Howtos  ›  Database  › 

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

Shulou Source: shulou.com Published: 2022-06-01 14:39:59 10月01日 Update

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

Tags: Big data script date time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Huawei Xiaomi Shulou Tech Info OPPO Reno