create or replace procedure amerce(quarterstart in varchar2,
quarterend in varchar2,
quarter in varchar2) is
V_m1 INTEGER;
v_vendor srm062.vendor%TYPE;
v_plant srm062.plant%TYPE;
v_acount_demif srm062.demif%TYPE; -- demif¼¾¶ÈºÏ¼Æ
v_o_demif srm061.demif%TYPE; --Ä¿±ê
-- v_o_ppm srm061.ppm%TYPE; --PPMÄ¿±ê
v_demifmoney srm065.demifmoney%TYPE;
v_Cdemifmoney srm065.demifmoney%TYPE;
v_startscope srm066.startscope%TYPE;
v_endscope srm066.endscope%TYPE;
v_menoy srm066.menoy%TYPE;
v_ppm srm065.Ppm%TYPE; --PPMºÏ¼Æ
cursor c_s061 is
select t.plant, t.vendor, sum(t.demif)
from srm062 t
where t.closedate > = TO_DATE(quarterstart, 'YYYY-MM-DD ')
and t.closedate <= TO_DATE(quarterend, 'YYYY-MM-DD ')
group by t.plant, t.vendor;
cursor c_s066 is
select s66.startscope, s66.endscope, s66.menoy from srm066 s66;
begin
OPEN C_S061;
LOOP
FETCH c_s061
into v_plant, v_vendor, v_acount_demif;
EXIT WHEN c_s061%NOTFOUND;
--Ä¿±êÖµ
select s.demif --, s.ppm
into v_o_demif --, v_o_ppm
from srm061 s
where s.plant = v_plant
and s.vendor = v_vendor