CREATE OR REPLACE PROCEDURE AP_PC_SAC_SYNC(
v_privid in varchar2,
v_contractperiod in varchar2,
v_dealergroup in varchar2,
v_sacvalue in varchar2,
v_begindate in varchar2,
v_enddate in varchar2) as
begin
begin
--del old record
delete from pc_priv_sac t
where t.privid=v_privid and t.contractperiod=v_contractperiod and t.DEALERGROUP=v_dealergroup;
--insert new record
insert into pc_priv_sac(PRIVID, CONTRACTPERIOD, ACCESSTYPE, SACVALUE, BEGINDATE,
ENDDATE, CREATEDATE, STATUS, STATUSDATE, DEALERGROUP)
values(v_privid, v_contractperiod, 'ALL', 100*to_number(v_sacvalue), to_date(v_begindate, 'YYYY-MM-DD HH24:MI:SS'),
to_date(v_enddate, 'YYYY-MM-DD HH24:MI:SS'), sysdate, 1, sysdate, v_dealergroup);
EXCEPTION
WHEN OTHERS THEN
null;
END;
end;