# FUNCTION
create or replace function fc_bpmgetstaus(vStartDay in varchar2, vDeadline in number, vstatus in varchar )
return varchar2 is
vReturn varchar2(2) :='';
vProgressDays number(2) :=0;
e_force EXCEPTION;
begin
begin
vProgressDays := trunc(sysdate - to_date(vStartDay,'yyyymmddhh24miss'));
if nvl(vDeadline,0) = 0 then
if vStatus = 'E' then
vReturn :='NE';
else
vReturn :='NP';
end if;
else
if vProgressDays >= vDeadline then
if vStatus = 'E' then
vReturn :='DE';
else
vReturn :='DP';
end if;
else -- 정상
if vStatus = 'E' then
vReturn :='NE';
else
vReturn :='NP';
end if;
end if;
end if;
exception
when others then
vReturn :='00';
RAISE e_force;
end;
return vReturn;
exception
when e_force then
vReturn := '00';
return vReturn;
end; |