orcal 循环执行sql

替换掉sql语句即可

declare   
  i integer;  
begin  
  i:=0;  
  for i in 1..20 loop  

 


delete from     DHS_DISEASE_HISTORY where id in (     select id from DHS_DISEASE_HISTORY a inner join

( select max(CONFIRMATION_DATE) CONFIRMATION_DATE, PERSON_ID,DISEASE_CODE  from DHS_DISEASE_HISTORY
 where PERSON_ID is not null and DISEASE_CODE is not null  group by PERSON_ID,DISEASE_CODE  having count(*) > 1)  b 

on a.CONFIRMATION_DATE=b.CONFIRMATION_DATE and a.PERSON_ID=b.PERSON_ID and  a.DISEASE_CODE=b.DISEASE_CODE  )  ;

 


  end loop;     
end;  

 

阅读更多

没有更多推荐了,返回首页