Methods of data archiving

--The method of data archiving
create or replace produced FW_JBPM_BACKUP_P is --Save the number
of records per archive
zc_date_number number;
v_number number;

begin
     select count(1) into v_number from user_tables where table_name = 'A';
     if (v_number) then--if no temporary table exists, create
     execute immediate 'create global temporay table A (id number(19) ,bizId number( 19) ,processName varchar2(255 char)) on commit delete rows';
     end if;
    
     --The archiving process starts, the core idea is to convert the copied query SQL into an intermediate table, which greatly improves the performance
     insert into A select * from (
            with S1 as (select * from B) ,S2 as (select * from C ,S1) ,S3 as (select * from D ,S2))
            select * from S1 ,S2 ,S3 ,A ,B ,C
     );
    
     -- query archive The number of records
     select count(1) into zc_date_number from A;
     output_line('Number of archived records' || zc_date_number);
    
     commit;
end FW_JBPM_BACKUP_P;

 


 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327088246&siteId=291194637