procedure_3
来源:互联网 发布:大数据 杂志 编辑:程序博客网 时间:2024/06/04 23:32
-- 12month
when 2 then
v_showkey := 'SHOW_TEST2';
select to_number(value) into v_showNum from t_sys_conf_test_parameters t where upper(t.name) = v_showkey ;
v_tablename :='T_TEST_M';
v_date :='a.MTIME';
v_filter := ' and to_date(d.DTIME,''yyyymmdd'') = last_day(trunc(add_months(to_date(a.MTIME,''yyyymm''),0),''mm''))
and to_date(c.DTIME,''yyyymmdd'') = last_day(trunc(add_months(to_date(a.MTIME,''yyyymm''),0),''mm''))
and to_date(b.DTIME,''yyyymmdd'') = last_day(trunc(add_months(to_date(a.MTIME,''yyyymm''),0),''mm''))
and a.MTIME>=to_char(add_months('||v_endtime ||',-'''||v_showNum||'''),''yyyymm'')
and a.MTIME<=to_char(add_months('||v_endtime ||',-1),''yyyymm'')
';
v_condition2:='(select to_char(add_months('||v_endtime ||',-rownum),''yyyymm'') dtime,
0 TEST1,0 TEST2 ,0 TEST3,
0 TEST4,0 TEST5,0 TEST6,0 TEST8,
0 TEST9,0 TEST10
from dual connect by rownum <= '''||v_showNum||''')';
-- v_num:='12';
end case;
---selectid
case
when (p_selectid = 'ALL' ) then
v_condition := 'and 1 = 1 ';
else
v_condition := 'and a.selectid = '''|| p_selectid ||''' ' ;
end case;
--select condition
if (p_select is null or upper(p_select) = 'ALL')
then
v_condition := v_condition;
else
--selectID: "select1,select2,select3"
v_select := replace(p_select,',',''',''');
v_condition :=v_condition || ' and a.relselect in ( ''' || v_select||''') ';
end if;
--get default records for display