--创建了一个存储过程执行嵌套语句
createorreplaceproceduresp_qtsz
/创建一个嵌套数组/
as
cursorname_curis
selectxmfromt_dx_xstwhererownum<4;
typename_typeistableoft_dx_xs.xm%type;
--shengming
name_tabname_type:=name_type();
v_counternumber:=0;
begin
forname_recinname_curloop
v_counter:=v_counter+1;
name_tab.extend;
name_tab(v_counter):=name_rec.xm;
dbms_output.put_line(name_tab(v_counter));
ifv_counter=1then
return;
endif;
endloop;
exception
whenothersthen
dbms_output.put_line(sqlerrm);
end;
--提交上个季度的数据
select(to_char(sysdate,''q'')-1)intov_jdfromdual;
ifv_jd=0then
select(to_char(sysdate,''yyyy'')-1)intov_nffromdual;
v_yf1:=v_nf||''12'';
v_yf2:=v_nf||''11'';
v_yf3:=v_nf||''10'';
else
selectto_char(sysdate,''yyyy'')intov_nffromdual;
v_yf1:=v_nf||(v_jd3+1);
v_yf2:=v_nf||(v_jd3+2);
v_yf3:=v_nf||(v_jd3+3);
endif;
selectcount(1)
intov_sjzs
fromt_dx_xst
whereto_char(t.rksj,''yyyymm'')=v_yf1
orto_char(t.rksj,''yyyymm'')=v_yf2
orto_char(t.rksj,''yyyymm'')=v_yf3;
|
|