如何在PLSQL中的另一个array2中复制一个array1?

时间:2017-07-24 14:22:36

标签: plsql

假设我有一个包含10行的小数组和另一个包含50行的大数组,我想将第二个数组中的第10行替换为小数组中的10行:

declare   
    nb_inactif_gcp number;
    nb_prem_gcp    number;
    type tab_pot is record(
        NUMR_DOSS_ECNM         number,
        ptf    number,
        SEG_BANCO_2020_RELT     varchar(9 BYTE),
        SF     number );
    type tab is table of tab_pot index by binary_integer ;
    tab_sup_pot tab ;
    type inac is record(
        NUMR_DOSS_ECNM         number,
        ptf    number,
        SEG_BANCO_2020_RELT     varchar(9 BYTE),
        SF     number);
    type tablo is table of inac index by binary_integer ;
    tab_inac tablo ;
    TYPE t_tab_emp IS VARRAY  ;
    tab_emp t_tab_emp; 
begin
    -------- initialisation and filling  the table
    for i in 1..nb_prem_gcp loop
            tab_sup_pot(i).NUMR_DOSS_ECNM := i ;
            tab_sup_pot(i).ptf := i;
            tab_sup_pot(i).SEG_BANCO_2020_RELT := 'C';
            tab_sup_pot(i).SF  := i;      
    end loop; 
    for i in 1..nb_prem_gcp loop                            
       select * into tab_sup_pot(i) 
       from (Select * 
             from 
             (Select * 
              from ptf_asup_sans_pro_prem_trie 
              where rownum<=i 
              order by rownum desc) b
         where rownum=1);
     end loop;
     ---initialisation and filling  the table
     for i in 1..nb_inactif_gcp loop
            tab_inac(i).NUMR_DOSS_ECNM := i ;
            tab_inac(i).ptf := i;
            tab_inac(i).SEG_BANCO_2020_RELT := 'C';
            tab_inac(i).SF  := i;      
    end loop; 
    for i in 1..nb_inactif_gcp 
    loop                            
       select * into tab_inac(i) 
       from (Select * 
             from (Select * 
                   from ptf_gcp_inactif
                   where rownum<=i 
                   order by rownum desc
              ) b where rownum=1);
   end loop;

我的问题在于我的代码中的这一部分,它不起作用:

   for i in 1..nb_inactif_gcp loop 

  tab_inac(i).NUMR_DOSS_ECNM := tab_sup_pot(i).NUMR_DOSS_ECNM ;
    tab_inac(i).ptf := tab_sup_pot(i).ptf;
    tab_inac(i).SEG_BANCO_2020_RELT := tab_sup_pot(i).SEG_BANCO_2020_RELT ;
    tab_inac(i).SF  :=  tab_sup_pot(i).SF ;
 end loop

end ;

如果你能帮助我,我将非常感激。

0 个答案:

没有答案