CREATE OR REPLACE PROCEDURE spServiceScore
(
v_ServiceType int,
v_SingleSkillAdd smallint,
v_Status out int
)
AS
null_value EXCEPTION;
SubProc_Error EXCEPTION;
No_Data EXCEPTION;
cursor cur_OprScoreDailyTable IS
select WorkDate,AgentID,CallTime,CallCount,AvgCallTime,TransferCount,
KeeponCount,WorkGroupID,SkillGroupID,MediaType
from tOprScoreDaily
where ServiceType = v_ServiceType and WorkDate = v_CurrentDay
and SubCCNO=v_SubCCNo and VDN=v_VDN;
BEGIN
select count(*) into v_num from tOprScoreSettingTable1
where ServiceType = v_ServiceType and SubCCNO=v_SubCCNo and VDN=v_VDN;
IF v_num <1 THEN
RAISE No_Data;
END IF;
open cur_OprScoreDailyTable ;
select count(*) INTO v_count from tOprScoreDaily
where ServiceType=v_ServiceType and WorkDate=v_CurrentDay
and SubCCNO=v_SubCCNo and VDN=v_VDN;
while v_count > 0 LOOP fetch cur_OprScoreDailyTable
into v_WorkDate ,v_AgentID,v_CallTime, v_CallCount,v_AvgCallTime,
v_TransferCount,v_KeeponCount,v_WorkGroupID,v_SkillGroupID,v_MediaType;
EXIT WHEN cur_OprScoreDailyTable%NOTFOUND;
select count(*) into v_Count1 from tOprScoreSettingTable1
where ServiceType = v_ServiceType and SubCCNO=v_SubCCNo and VDN=v_VDN and MediaType=v_MediaType and rownum=1;
if v_Count1=0 then
goto label_endofloop;
end if;
IF (v_CallTime_ComputeType<1 OR v_CallTime_ComputeType>11) then
close cur_OprScoreDailyTable ;
v_Status := -131;
rollback;
return ;
END IF;
spVarItemScore ( v_ServiceType1,3,v_AgentID,v_CurrentDay,v_SubCCNo,v_VDN,v_MediaType,v_ServiceAdd3Score ,v_iRet );
if v_iRet <> 0 then
v_Status:=v_iRet;
RAISE SubProc_Error;
end if;
<<label_totalcompute>>
if (v_CallTimeScore = v_ZeroFlag)
or (v_CountScore = v_ZeroFlag)
or (v_ServiceAdd3Score = v_ZeroFlag) then
v_ServiceAdd3Score := 0 ;
end IF;
<<label_endofloop>>
v_count := v_count-1 ;
end LOOP;
close cur_OprScoreDailyTable ;
COMMIT;
EXCEPTION
WHEN No_Data THEN
v_Status:=-111;
RETURN;
WHEN null_value THEN
v_Status:=2;
RETURN;
WHEN SubProc_Error THEN
close cur_OprScoreDailyTable ;
ROLLBACK ;
return ;
WHEN OTHERS THEN
v_Status:=1 ;
close cur_OprScoreDailyTable ;
ROLLBACK ;
return;
END spServiceScore;
/