sql 循环写法

declare 

  uuid varchar2(38);
-- 游标 
  cursor cur_data is select * from bas.bas_mof_div where level_no = 1 AND MOF_DIV_CODE <> '330200000';
begin
  for cur_row in cur_data loop
      for detail_row in (select * from pm_s_pro_est_detail where mof_div_code='330200000') loop
          for detail_cri_row in (select * from pm_s_pro_est_detail_cri cri where cri.pro_drtdtl_id = detail_row.pro_drtdtl_id and  cri.mof_div_code='330200000') loop
            uuid := detail_cri_row.pro_drtdtl_id;
            dbms_output.put_line(uuid);
          end loop;
      end loop;
  end loop;
  -- commit;
end;

你可能感兴趣的:(sql 循环写法)