記錄一次雙重for循環(huán)的存儲(chǔ)過程

create or replace procedure lyshzyzd_pro is

  cursor temp_cursor is
    select XMBM, substr(CITY, 0, 2)||'市' as city, ZDMC, LATITUDE, LONGITUDE,county
      from LYSHZYZD_TEMP;

  cursor basePoint_cursor(city varchar2,county varchar2) is
    select t.provice_name,
           t.city_name,
           t.city_id,
           t.county_name,
           t.county_id,
           t.zh_label,
           t.zh_code,
           t.address,
           t.strategic_resid,
           t.strategic_resname,
           t.strategic_type,
           t.contact_no,
           t.contact_name,
           t.strategic_agreements_name,
           t.company_name,
           t.company_id,
           t.kc_statue,
           t.xy_statue,
           t.remark,
           t.int_id,
           t.stateflag,
           t.time_stamp,
           t.creator,
           t.creat_time,
           t.modifier,
           t.modify_time,
           t.points_layyer,
           t.res_type,
           t.other_type,
           t.be_res_type,
           t.file_id,
           t.photo,
           t.have_govfile,
           t.govfile_name,
           t.longitude1,
           t.latitude1
      from rmw.res_base_point_resources t
     where city_name = city and county_name=county;

begin
  begin
    for temp in temp_cursor LOOP
     dbms_output.put_line(temp.city||temp.county||temp.xmbm);
      for basePoint in basePoint_cursor(temp.city,temp.county) LOOP
        if getdistance(temp.latitude,
                       temp.longitude,
                       basePoint.latitude1,
                       basePoint.longitude1) <= 20 then
          begin
            insert into RES_BASE_POINT_RESOURCES_TEMP
              (provice_name,
               city_name,
               city_id,
               county_name,
               county_id,
               zh_label,
               zh_code,
               address,
               strategic_resid,
               strategic_resname,
               strategic_type,
               contact_no,
               contact_name,
               strategic_agreements_name,
               company_name,
               company_id,
               kc_statue,
               xy_statue,
               remark,
               int_id,
               stateflag,
               time_stamp,
               creator,
               creat_time,
               modifier,
               modify_time,
               points_layyer,
               res_type,
               other_type,
               be_res_type,
               file_id,
               photo,
               have_govfile,
               govfile_name,
               longitude1,
               latitude1,
               xmbm)
            values
              (basePoint.provice_name,
               basePoint.city_name,
               basePoint.city_id,
               basePoint.county_name,
               basePoint.county_id,
               basePoint.zh_label,
               basePoint.zh_code,
               basePoint.address,
               basePoint.strategic_resid,
               basePoint.strategic_resname,
               basePoint.strategic_type,
               basePoint.contact_no,
               basePoint.contact_name,
               basePoint.strategic_agreements_name,
               basePoint.company_name,
               basePoint.company_id,
               basePoint.kc_statue,
               basePoint.xy_statue,
               basePoint.remark,
               basePoint.int_id,
               basePoint.stateflag,
               basePoint.time_stamp,
               basePoint.creator,
               basePoint.creat_time,
               basePoint.modifier,
               basePoint.modify_time,
               basePoint.points_layyer,
               basePoint.res_type,
               basePoint.other_type,
               basePoint.be_res_type,
               basePoint.file_id,
               basePoint.photo,
               basePoint.have_govfile,
               basePoint.govfile_name,
               basePoint.longitude1,
               basePoint.latitude1,
               temp.xmbm
               );
            commit;
          end;
        end if;
      end Loop;
 
    end loop;
  end;

end lyshzyzd_pro;

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容