oracle 新的数据库新的change
发布时间:2020-12-12 14:31:49 所属栏目:百科 来源:网络整理
导读:--本游标是处理 declare cursor c is select JIOYRQ,tjjgh,TJGY,bxgs,sum(jioyje) jioyjesum,count(tbdh) tbdhsum from bx_mir_dsmx WHERE jioyrq = V_SYSDAT group by JIOYRQ,bxgs; v_jioyrq t_ls2_tj020_01.jioyrq%type; v_tjjgh t_ls2_tj020_01.tjjgh%type
--本游标是处理 declare cursor c is select JIOYRQ,tjjgh,TJGY,bxgs,sum(jioyje) jioyjesum,count(tbdh) tbdhsum from bx_mir_dsmx WHERE jioyrq = V_SYSDAT group by JIOYRQ,bxgs; v_jioyrq t_ls2_tj020_01.jioyrq%type; v_tjjgh t_ls2_tj020_01.tjjgh%type; v_TJGY T_LS2_TJ020_01.TJGY%type; v_bxgs t_ls2_tj020_01.bxgs%type; V_JIOYJESUM T_LS2_tj020_01.JIOYJESUM%TYPE; V_TBDHSUM T_LS2_tj020_01.TBDHSUM%TYPE; /*cursor p is select count(*) khsum from (select distinct tbr,lxdh from bx_mir_dsmx where jioyrq=v_jioyrq and TJGY=v_TJGY and bxgs=v_bxgs);*/ v_khsum t_ls2_tj020_01.khsum%type; begin open c; loop fetch c into v_jioyrq,v_tjjgh,v_TJGY,v_bxgs,V_JIOYJESUM,V_TBDHSUM; exit when c%notfound; --open p; --fetch p into v_khsum; --exit when p%notfound; select count(*) into v_khsum from (select distinct tbr,lxdh from bx_mir_dsmx where jioyrq = v_jioyrq and TJGY = v_TJGY and bxgs = v_bxgs); insert into t_ls2_tj020_01 (jioyrq,TJJGH,BXGS,JIOYJESUM,TBDHSUM,khsum) values (v_jioyrq,V_TBDHSUM,v_khsum); commit; --close p; end loop; close c; end; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |