标签:
CREATE OR REPLACE PACKAGE BODY DD_PAK_new
IS
/****************************************************************************************
NAME: DD_PAK
PURPOSE: 豆豆大冒险
REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
2.0 2015-06-12 xulei
*******************************************************************************************/
PROCEDURE DD_USER(IN_CALLING_NBR IN VARCHAR2,
IN_CALLED_NBR IN VARCHAR2,
IN_CALL_TIME IN VARCHAR2,
OUT_RESULT OUT VARCHAR2)
/****************************************
功能:用户参与答题接口(高阳侧完成)——调用此接口,用户即为老用户
涉及数据库表:DD_USER_LIST
*****************************************/
IS
V_DATE DATE;
/*告警模块参数*/
v_alarm_team NUMBER := 98; --短信告警组别
V_ALARM_HAND varchar2(50);
V_ALARM_MSG VARCHAR2(1024);
V_SQLTEXT VARCHAR2(1024);
BEGIN
OUT_RESULT :=‘0‘ ;
V_ALARM_HAND := ‘DD_PAK.DD_USER‘;
V_DATE := TO_DATE(IN_CALL_TIME, ‘YYYY-MM-DD HH24:MI:SS‘);
--记录鉴权日志表
INSERT INTO DD_USER_LIST(CALLING_NBR, CALLED_NBR, BILL_TIME, CREATE_DATE)
VALUES (IN_CALLING_NBR,IN_CALLED_NBR,V_DATE, SYSDATE);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
rollback;
OUT_RESULT := ‘1‘;
V_ALARM_MSG := SQLERRM;
--错误日志表
V_SQLTEXT := ‘CALL DD_PAK.ERRLOG(:V1,:V2,:V3,:V4,:V5)‘;
EXECUTE IMMEDIATE V_SQLTEXT
USING IN_CALLING_NBR, IN_CALLED_NBR, V_ALARM_HAND, V_ALARM_MSG, IN_CALL_TIME;
--告警
v_sqltext := ‘call alarm_exec_prc ( :v1, :v2, :v3 )‘;
EXECUTE IMMEDIATE v_sqltext
USING V_ALARM_HAND, v_alarm_msg, v_alarm_team;
END DD_USER;
PROCEDURE DD_USER_Judge(IN_CALLING_NBR IN VARCHAR2,
IN_CALLED_NBR IN VARCHAR2,
IN_CALL_TIME IN VARCHAR2,
OUT_RESULT OUT VARCHAR2,
OUT_gold OUT VARCHAR2)
/****************************************
功能:用户参与答题接口(高阳侧完成)——调用此接口,用户即为老用户
涉及数据库表:DD_USER_LIST中只要存在,视为老用户
OUT_RESULT 0:新用户 1:老用户 2 异常
*****************************************/
IS
V_DATE DATE;
v_count number;
/*告警模块参数*/
v_alarm_team NUMBER := 98; --短信告警组别
V_ALARM_HAND varchar2(50);
V_ALARM_MSG VARCHAR2(1024);
V_SQLTEXT VARCHAR2(1024);
v_gold number;
BEGIN
OUT_RESULT :=‘0‘ ;
V_ALARM_HAND := ‘DD_USER_Judge‘;
V_DATE := TO_DATE(IN_CALL_TIME, ‘YYYY-MM-DD HH24:MI:SS‘);
--记录鉴权日志表
select count(1) into v_count
from DD_USER_LIST
where CALLING_NBR=trim(IN_CALLING_NBR);
if v_count=0
then OUT_RESULT:=‘0‘;
else OUT_RESULT:=‘1‘;
end if;
INSERT INTO DD_USER_LISTlog(CALLING_NBR, CALLED_NBR, BILL_TIME, CREATE_DATE)
VALUES (IN_CALLING_NBR,IN_CALLED_NBR,TO_DATE(IN_CALL_TIME, ‘YYYY-MM-DD HH24:MI:SS‘), SYSDATE);
COMMIT;
--累计金币数算当前月的数据,xi。
select nvl(sum(GOLD_COUNT),0) into OUT_gold
from DD_user_desc a
where calling_nbr=IN_CALLING_NBR
--and substr(a.called_nbr,1,9) = substr(IN_CALLED_NBR,1,9) --20160307 by xie
AND CREATE_DATE>=TRUNC(sysdate,‘MM‘)
AND CREATE_DATE<LAST_DAY(TRUNC(sysdate))+1;
--if IN_CALLED_NBR = ‘125904030209‘ then
select nvl(sum(GOLD_COUNT), 0)
into v_gold
from DD_user_desc
where calling_nbr = IN_CALLING_NBR
AND CREATE_DATE >= TRUNC(SYSDATE)
AND CREATE_DATE < TRUNC(SYSDATE) + 1;
if v_gold >= 20 then
OUT_RESULT := 2;
return;
end if;
select nvl(sum(GOLD_COUNT), 0)
into v_gold
from DD_user_desc
where calling_nbr = IN_CALLING_NBR
AND CREATE_DATE >= TRUNC(SYSDATE,‘mm‘)
AND CREATE_DATE < add_months(TRUNC(SYSDATE,‘mm‘),1);
if v_gold >= 100 then
OUT_RESULT := 3;
end if;
--end if;
EXCEPTION
WHEN OTHERS THEN
OUT_RESULT := ‘2‘;
V_ALARM_MSG := SQLERRM;
--错误日志表
V_SQLTEXT := ‘CALL DD_PAK.ERRLOG(:V1,:V2,:V3,:V4,:V5)‘;
EXECUTE IMMEDIATE V_SQLTEXT
USING IN_CALLING_NBR, IN_CALLED_NBR, V_ALARM_HAND, V_ALARM_MSG, IN_CALL_TIME;
--告警
v_sqltext := ‘call alarm_exec_prc ( :v1, :v2, :v3 )‘;
EXECUTE IMMEDIATE v_sqltext
USING V_ALARM_HAND, v_alarm_msg, v_alarm_team;
END DD_USER_Judge;
PROCEDURE DD_AQ( IN_CALLING_NBR IN VARCHAR2,
IN_CALLED_NBR IN VARCHAR2,
IN_CALL_TIME IN VARCHAR2,
IN_QUES_COUNT IN VARCHAR2,
OUT_VOXNAME OUT VARCHAR2,
OUT_ANWSER OUT VARCHAR2)
/****************************************
功能:获取题目及答案接口
涉及数据库表:DD_QA_LIST 共用题库随机返回题目名称以及答案
*****************************************/
IS
V_DATE DATE;
v_count number:=TO_NUMBER(IN_QUES_COUNT);
/*告警模块参数*/
v_alarm_team NUMBER := 98; --短信告警组别
V_ALARM_HAND varchar2(50);
V_ALARM_MSG VARCHAR2(1024);
V_SQLTEXT VARCHAR2(1024);
v_count1 number;
v_count2 number;
BEGIN
OUT_VOXNAME:=NULL;
OUT_ANWSER:=NULL;
V_ALARM_HAND := ‘DD_AQ‘;
V_DATE := TO_DATE(IN_CALL_TIME, ‘YYYY-MM-DD HH24:MI:SS‘);
--深白90道题目优先选择,然后再随机选择题目
--if substr(IN_CALLED_NBR,1,11) = ‘12590503232‘ then
select count(*) into v_count1 from DD_QA_LIST_log a where a.calling_nbr = IN_CALLING_NBR;
select count(*) into v_count2 from dd_qa_list_first a where a.flag = ‘Y‘;
if (v_count2 - v_count1) >= v_count then
for j in (
SELECT *
FROM (SELECT *
FROM dd_qa_list_first
where answer_desc not in (select b.answer_desc from DD_QA_LIST_log b where b.calling_nbr = IN_CALLING_NBR)
and flag = ‘Y‘
ORDER BY DBMS_RANDOM.RANDOM)
WHERE ROWNUM <= v_count)
loop
OUT_VOXNAME:=j.ANSWER_DESC||‘,‘||OUT_VOXNAME;
OUT_ANWSER:=j.QUES_DESC||‘,‘||OUT_ANWSER;
insert into DD_QA_LIST_log values(j.id, j.answer_desc,j.nr_desc, j.ques_desc,j.ques_format,j.flag,sysdate,IN_CALLING_NBR);
commit;
end loop;
elsif (v_count2 - v_count1) < v_count and (v_count2 - v_count1) > 0 then
for j in (
SELECT *
FROM (SELECT *
FROM dd_qa_list_first
where answer_desc not in
(select b.answer_desc from DD_QA_LIST_log b where b.calling_nbr = IN_CALLING_NBR)
and flag = ‘Y‘
ORDER BY DBMS_RANDOM.RANDOM)
WHERE ROWNUM <= (v_count2 - v_count1))
loop
OUT_VOXNAME:=j.ANSWER_DESC||‘,‘||OUT_VOXNAME;
OUT_ANWSER:=j.QUES_DESC||‘,‘||OUT_ANWSER;
insert into DD_QA_LIST_log values(j.id, j.answer_desc,j.nr_desc, j.ques_desc,j.ques_format,j.flag,sysdate,IN_CALLING_NBR);
commit;
end loop;
for i in (
SELECT ANSWER_DESC, QUES_DESC
FROM (SELECT *
FROM DD_QA_LIST
where answer_desc not in (select b.answer_desc from DD_QA_LIST_log b where b.calling_nbr = IN_CALLING_NBR)
and flag = ‘Y‘
ORDER BY DBMS_RANDOM.RANDOM)
WHERE ROWNUM <= v_count - v_count2 - v_count1)
loop
OUT_VOXNAME:=i.ANSWER_DESC||‘,‘||OUT_VOXNAME;
OUT_ANWSER:=i.QUES_DESC||‘,‘||OUT_ANWSER;
end loop;
else
for i in (
SELECT ANSWER_DESC, QUES_DESC
FROM (SELECT * FROM DD_QA_LIST where flag = ‘Y‘ ORDER BY DBMS_RANDOM.RANDOM)
WHERE ROWNUM <= v_count)
loop
OUT_VOXNAME:=i.ANSWER_DESC||‘,‘||OUT_VOXNAME;
OUT_ANWSER:=i.QUES_DESC||‘,‘||OUT_ANWSER;
end loop;
end if;
/*else
for i in (
SELECT ANSWER_DESC,QUES_DESC
FROM (
SELECT *
FROM DD_QA_LIST
ORDER BY DBMS_RANDOM.RANDOM)
WHERE ROWNUM<=v_count)
loop
OUT_VOXNAME:=i.ANSWER_DESC||‘,‘||OUT_VOXNAME;
OUT_ANWSER:=i.QUES_DESC||‘,‘||OUT_ANWSER;
end loop;
end if;*/
OUT_VOXNAME:=rtrim(OUT_VOXNAME,‘,‘);
OUT_ANWSER:=rtrim(OUT_ANWSER,‘,‘);
EXCEPTION
WHEN OTHERS THEN
V_ALARM_MSG := SQLERRM;
--错误日志表
V_SQLTEXT := ‘CALL DD_PAK.ERRLOG(:V1,:V2,:V3,:V4,:V5)‘;
EXECUTE IMMEDIATE V_SQLTEXT
USING IN_CALLING_NBR, IN_CALLED_NBR, V_ALARM_HAND, V_ALARM_MSG, IN_CALL_TIME;
--告警
v_sqltext := ‘call alarm_exec_prc ( :v1, :v2, :v3 )‘;
EXECUTE IMMEDIATE v_sqltext
USING V_ALARM_HAND, v_alarm_msg, v_alarm_team;
END DD_AQ;
PROCEDURE DD_MC( IN_CALLING_NBR IN VARCHAR2,
IN_CALLED_NBR IN VARCHAR2,
IN_CALL_TIME IN VARCHAR2,
IN_QUES_COUNT IN VARCHAR2,
OUT_number OUT VARCHAR2,
OUT_gold OUT VARCHAR2,
out_flag out varchar2)
/****************************************
功能:获取名次及查询累计积分接口
时间规则:排名从每天早上10点钟从1开始计算
累计金币计算当前月累计。
涉及数据库表:DD_user_desc
IN_QUES_COUNT(大于等于5,产生名次,小于5,不返回排名约定返回空,但要返回第二个返回值)
OUT_number: 用户排名(例如:18,标识第18名)需注意名次生成规则(7月16日增加挑战不成功用户即IN_QUES_COUNT小于5不参与排名)
OUT_gold:当前用户累计金币数量需注意金币生成及累加规则
排名尾号判断规则:播放完用户排名后,系统判断此排名的尾号。
(1) 优先级1:尾号最后3位是“555”或“888”——奖励100单位。
(2) 优先级2:尾号最后2位是“55”或“88”——奖励8单位。
(3) 优先级3:尾号最后1位是“5”或“8”——奖励2单位。
(4) 优先级4:尾号最后1位不是“5”或“8”——不奖励。
*****************************************/
IS
V_DATE DATE;
v_id number;
v_gold number;
v_old_gold number;
V_START_DATE DATE;
V_END_DATE DATE;
V_ROW_ID NUMBER;
V_QUES_COUNT NUMBER:=TO_NUMBER(IN_QUES_COUNT);
/*告警模块参数*/
v_alarm_team NUMBER := 98; --短信告警组别
V_ALARM_HAND varchar2(50);
V_ALARM_MSG VARCHAR2(1024);
V_SQLTEXT VARCHAR2(1024);
v_old_gold_day number;
v_old_gold_mon number;
BEGIN
OUT_number:=NULL;
OUT_gold:=0;
out_flag:=0;
V_ALARM_HAND := ‘DD_MC‘;
V_DATE:= TO_DATE(IN_CALL_TIME, ‘YYYY-MM-DD HH24:MI:SS‘);
--累计金币数算当前月的数据。
select nvl(sum(GOLD_COUNT),0) into v_old_gold
from DD_user_desc a
where calling_nbr=IN_CALLING_NBR
--and substr(a.called_nbr,1,9) = substr(IN_CALLED_NBR,1,9) --20160307 by xie
AND CREATE_DATE>=TRUNC(sysdate,‘MM‘)
AND CREATE_DATE<LAST_DAY(TRUNC(sysdate))+1;
select nvl(sum(GOLD_COUNT),0) into v_old_gold_day
from DD_user_desc a
where calling_nbr=IN_CALLING_NBR
--and substr(a.called_nbr,1,9) = substr(IN_CALLED_NBR,1,9) --20160307 by xie
AND CREATE_DATE>=TRUNC(SYSDATE)
AND CREATE_DATE<TRUNC(SYSDATE)+1;
/*select nvl(sum(GOLD_COUNT),0) into v_old_gold_mon
from DD_user_desc a
where calling_nbr=IN_CALLING_NBR
--and substr(a.called_nbr,1,9) = substr(IN_CALLED_NBR,1,9) --20160307 by xie
AND CREATE_DATE>=TRUNC(SYSDATE,‘mm‘)
AND CREATE_DATE<add_months(TRUNC(SYSDATE,‘mm‘),1);*/
select DD_USER_SEQ.nextval into v_id
from dual;
--排名从每天早上10点钟从1开始计算,设定每次呼叫的排名周期
IF
TO_CHAR(V_DATE,‘HH24‘)>=‘08‘
THEN V_START_DATE:=TO_DATE(TO_CHAR(TRUNC(V_DATE),‘YYYY-MM-DD‘)||‘ 08:00:00‘,‘YYYY-MM-DD HH24:MI:SS‘);
V_END_DATE:=TO_DATE(TO_CHAR(TRUNC(V_DATE)+1,‘YYYY-MM-DD‘)||‘ 07:59:59‘,‘YYYY-MM-DD HH24:MI:SS‘);
ELSIF TO_CHAR(V_DATE,‘HH24‘)<‘08‘
THEN V_START_DATE:=TO_DATE(TO_CHAR(TRUNC(V_DATE)-1,‘YYYY-MM-DD‘)||‘ 08:00:00‘,‘YYYY-MM-DD HH24:MI:SS‘);
V_END_DATE:=TO_DATE(TO_CHAR(TRUNC(V_DATE),‘YYYY-MM-DD‘)||‘ 07:59:59‘,‘YYYY-MM-DD HH24:MI:SS‘);
ELSE
V_ALARM_MSG := ‘TIME ERROR‘;
--错误日志表
V_SQLTEXT := ‘CALL DD_PAK.ERRLOG(:V1,:V2,:V3,:V4,:V5)‘;
EXECUTE IMMEDIATE V_SQLTEXT
USING IN_CALLING_NBR, IN_CALLED_NBR, V_ALARM_HAND, V_ALARM_MSG, IN_CALL_TIME;
END IF;
--入表记录,不考虑排名,金币
insert into DD_user_desc ( CALLING_NBR, CALLED_NBR, BILL_TIME, QUES_COUNT,EFF_DATE, EXP_DATE,ID)
values(IN_CALLING_NBR,IN_CALLED_NBR,V_DATE,V_QUES_COUNT,V_START_DATE,V_END_DATE,v_id);
--答题小于5,不排名
IF V_QUES_COUNT>=3
THEN NULL;
ELSE
GOTO NEXT_FLAG;
END IF;
SELECT ROW_NUM,QUES_COUNT INTO V_ROW_ID,V_QUES_COUNT
FROM (
SELECT ROWNUM ROW_NUM, id,CALLING_NBR, CALLED_NBR, BILL_TIME, QUES_COUNT, GOLD_COUNT, EFF_DATE, EXP_DATE
FROM
( select *
from DD_user_desc
WHERE BILL_TIME>=V_START_DATE
AND BILL_TIME<=V_END_DATE
AND QUES_COUNT>=3
ORDER BY BILL_TIME))
where ID=v_id;
select max(a.real_num) + 1 into V_ROW_ID
from DD_user_desc a
WHERE BILL_TIME>=V_START_DATE
AND BILL_TIME<=V_END_DATE;
if V_ROW_ID is null then
V_ROW_ID := 1;
end if;
--根据排名,计算金币
if v_old_gold_day >= 20 or v_old_gold >= 100 then
v_gold := 0;
else
v_gold := 10;
end if;
/*if substr(IN_CALLED_NBR,1,11) = ‘12590503232‘ then
if mod(V_ROW_ID,2)=0 then
v_gold := 10;
else
v_gold:=0;
end if;
elsif IN_CALLED_NBR = ‘125904030209‘ then
v_gold := 10;
else
if substr(V_ROW_ID,-3) in (‘555‘,‘888‘)
then v_gold:=100;
elsif substr(V_ROW_ID,-2) in (‘55‘,‘88‘)
then v_gold:=10; --8
elsif substr(V_ROW_ID,-1) in (‘5‘,‘8‘)
then v_gold:=5; --2
else v_gold:=0;
end if;
end if;*/
<<NEXT_FLAG>>
IF V_QUES_COUNT>=3
THEN OUT_gold:=v_gold+v_old_gold;
OUT_number:=V_ROW_ID;
ELSE
v_gold:=0;
OUT_number:=null;
OUT_gold:=v_old_gold;
END IF;
UPDATE DD_user_desc SET GOLD_COUNT=v_gold,REAL_NUM=OUT_number WHERE ID=v_id;
commit;
--if IN_CALLED_NBR = ‘125904030209‘ then
select nvl(sum(GOLD_COUNT), 0)
into v_gold
from DD_user_desc
where calling_nbr = IN_CALLING_NBR
AND CREATE_DATE >= TRUNC(SYSDATE)
AND CREATE_DATE < TRUNC(SYSDATE) + 1;
if v_gold >= 20 then
out_flag := 2;
/*UPDATE DD_user_desc SET GOLD_COUNT=0 WHERE ID=v_id;
commit;*/
return;
else
out_flag := 0;
end if;
select nvl(sum(GOLD_COUNT), 0)
into v_gold
from DD_user_desc
where calling_nbr = IN_CALLING_NBR
AND CREATE_DATE >= TRUNC(SYSDATE,‘mm‘)
AND CREATE_DATE < add_months(TRUNC(SYSDATE,‘mm‘),1);
if v_gold >= 100 then
out_flag := 3;
/*UPDATE DD_user_desc SET GOLD_COUNT=0 WHERE ID=v_id;
commit;*/
else
out_flag := 0;
end if;
--end if;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
OUT_number:=NULL;
OUT_gold:=NULL;
V_ALARM_MSG := ‘USER_ID=‘||v_id||‘,未找到数据‘||SQLERRM;
--错误日志表
V_SQLTEXT := ‘CALL DD_PAK.ERRLOG(:V1,:V2,:V3,:V4,:V5)‘;
EXECUTE IMMEDIATE V_SQLTEXT
USING IN_CALLING_NBR, IN_CALLED_NBR, V_ALARM_HAND, V_ALARM_MSG, IN_CALL_TIME;
--告警
v_sqltext := ‘call alarm_exec_prc ( :v1, :v2, :v3 )‘;
EXECUTE IMMEDIATE v_sqltext
USING V_ALARM_HAND, v_alarm_msg, v_alarm_team;
WHEN OTHERS THEN
OUT_number:=NULL;
OUT_gold:=NULL;
V_ALARM_MSG := SQLERRM;
--错误日志表
V_SQLTEXT := ‘CALL DD_PAK.ERRLOG(:V1,:V2,:V3,:V4,:V5)‘;
EXECUTE IMMEDIATE V_SQLTEXT
USING IN_CALLING_NBR, IN_CALLED_NBR, V_ALARM_HAND, V_ALARM_MSG, IN_CALL_TIME;
--告警
v_sqltext := ‘call alarm_exec_prc ( :v1, :v2, :v3 )‘;
EXECUTE IMMEDIATE v_sqltext
USING V_ALARM_HAND, v_alarm_msg, v_alarm_team;
end DD_MC;
PROCEDURE DD_CX( IN_CALLING_NBR IN VARCHAR2,
IN_CALLED_NBR IN VARCHAR2,
IN_CALL_TIME IN VARCHAR2,
OUT_gold OUT VARCHAR2)
/****************************************
功能:查询用户当月账户话费金额接口(高阳侧完成)——用户参与豆豆大作战获得金币(原来的金币现改为话费)
用户拨打豆豆大作战业务,当月账户获得8个金币,用户拨打12590900111可查询本月当前账户金额
*****************************************/
IS
V_DATE DATE;
V_START_DATE DATE;
V_END_DATE DATE;
/*告警模块参数*/
v_alarm_team NUMBER := 98; --短信告警组别
V_ALARM_HAND varchar2(50);
V_ALARM_MSG VARCHAR2(1024);
V_SQLTEXT VARCHAR2(1024);
BEGIN
OUT_gold:=NULL;
V_ALARM_HAND := ‘DD_CX‘;
V_DATE:= TO_DATE(IN_CALL_TIME, ‘YYYY-MM-DD HH24:MI:SS‘);
select nvl(sum(GOLD_COUNT),0) into OUT_gold
from DD_user_desc
where calling_nbr=IN_CALLING_NBR
AND CREATE_DATE>=TRUNC(SYSDATE,‘MM‘)
AND CREATE_DATE<LAST_DAY(TRUNC(SYSDATE))+1;
EXCEPTION
WHEN OTHERS THEN
OUT_gold:=NULL;
V_ALARM_MSG := SQLERRM;
--错误日志表
V_SQLTEXT := ‘CALL DD_PAK.ERRLOG(:V1,:V2,:V3,:V4,:V5)‘;
EXECUTE IMMEDIATE V_SQLTEXT
USING IN_CALLING_NBR, IN_CALLED_NBR, V_ALARM_HAND, V_ALARM_MSG, IN_CALL_TIME;
--告警
v_sqltext := ‘call alarm_exec_prc ( :v1, :v2, :v3 )‘;
EXECUTE IMMEDIATE v_sqltext
USING V_ALARM_HAND, v_alarm_msg, v_alarm_team;
end DD_CX;
PROCEDURE ERRLOG(IN_CALLING_NBR VARCHAR2,IN_CALLED_NBR VARCHAR2,IN_HAND VARCHAR2,IN_MSG VARCHAR2,CALL_TIME VARCHAR2)
IS
V_DATE DATE;
V_SQLTEXT VARCHAR2(1024);
BEGIN
V_SQLTEXT:=‘INSERT INTO ERR_LOG VALUES(:V1,:V2,:V3,:V4,:V5,:V6)‘;
EXECUTE IMMEDIATE V_SQLTEXT
USING IN_CALLING_NBR,IN_CALLED_NBR,IN_HAND,IN_MSG,CALL_TIME,SYSDATE;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN ROLLBACK;
END ERRLOG;
/*记录用户答题情况接口*/
PROCEDURE dd_AQrecord( IN_CALLING_NBR IN VARCHAR2,
IN_CALLED_NBR IN VARCHAR2,
in_answervox in varchar2,
in_answerflag in varchar2,
IN_CALL_TIME IN VARCHAR2
)
as
/*告警模块参数*/
v_alarm_team NUMBER := 98; --短信告警组别
V_ALARM_HAND varchar2(50);
V_ALARM_MSG VARCHAR2(1024);
V_SQLTEXT VARCHAR2(1024);
begin
--判断信息是否完整
if IN_CALLING_NBR is null then
return;
end if;
if in_answervox is null then
return;
end if;
--记录答题情况
insert into dd_AQ_record (id,
calling_nbr,
called_nbr,
answervox,
answerflag,
calltime,
createtime
)
values (DD_aq_seq.Nextval,
IN_CALLING_NBR,
IN_CALLED_NBR,
in_answervox,
in_answerflag,
TO_DATE(IN_CALL_TIME, ‘YYYY-MM-DD HH24:MI:SS‘),
sysdate);
commit;
EXCEPTION
WHEN OTHERS THEN
V_ALARM_MSG := SQLERRM;
--错误日志表
V_SQLTEXT := ‘CALL DD_PAK.ERRLOG(:V1,:V2,:V3,:V4,:V5)‘;
EXECUTE IMMEDIATE V_SQLTEXT
USING IN_CALLING_NBR, IN_CALLED_NBR, V_ALARM_HAND, V_ALARM_MSG, IN_CALL_TIME;
--告警
v_sqltext := ‘call alarm_exec_prc ( :v1, :v2, :v3 )‘;
EXECUTE IMMEDIATE v_sqltext
USING V_ALARM_HAND, v_alarm_msg, v_alarm_team;
end;
END DD_PAK_new;
标签:
原文地址:http://www.cnblogs.com/zhangwensi/p/5726180.html