写一个存储过程。
表CCRM_Service字段depid(int)SetTime期限(datetime)AcceptTime受理时间(dateTime),Workstart(dateti...
表CCRM_Service 字段 depid (int)SetTime 期限(datetime)AcceptTime受理时间(dateTime),Workstart(datetime)开始时间,WorkEndTime 工作结束时间(dateTime),Workstate(varchar(20)) (业务状态:已处理,处理中,办结)
表CCRM_Deptment 部门表 depid ,CPName(部门名称)
表 CCRM_UserList 用户表 ID,Name,depid
写一个存储过程统计一下 该业务的受理量 ,完成量 (办结的和已处理的),超时量,
在depid=0时 按照部门进行分组
depid<>0时 根据 选择的部门id 分组 展开
表CCRM_Deptment 部门表 depid ,CPName(部门名称)
表 CCRM_UserList 用户表 ID,Name,depid
写一个存储过程统计一下 该业务的受理量 ,完成量 (办结的和已处理的),超时量,
在depid=0时 按照部门进行分组
depid<>0时 根据 选择的部门id 分组 展开
展开全部
我觉得闹薯闹你的业务口径没有描述清楚,但是我连猜带蒙的写了一下,你看看符合你的需求否
CREATE OR REPLACE PROCEDURE p_ccrm
(v_depid ccrm_deptment.depid%type)
AS
v_shouliliang number(100);
v_wangchengliang number(100);
v_chaoshiliang number(100);
BEGIN
手渣 IF(V_DEPID=0)
THEN
select count(distinct id) shouliliang
,sum(case when workstate='已处理' or workstate='办结' then 1 else 0 end) wanchengliang
,sum(case when workendtime-workstart > XX then 1 else 0 end) chaoshiliang
into v_shouliliang,v_wanchengliang,v_chaoshiliang
from ccrm_service cs,ccrm_userlist cu,ccrm_deptment cd
where cd.depid=cs.depid
and cd.depid=cu.depid
group by deptid;
else
select count(distinct id) shouliliang
,sum(case when workstate='已处理' or workstate='办结' then 1 else 0 end) wanchengliang
,sum(case when workendtime-workstart > XX then 1 else 0 end) chaoshiliang
into v_shouliliang,v_wanchengliang,v_chaoshiliang
from ccrm_service cs,ccrm_userlist cu,ccrm_deptment cd
where cd.depid=cs.depid
and cd.depid=cu.depid
and cd.depid=v_depid
group by id;
end if;
DBMS_OUTPUT.PUT_LINE("受液罩理量:"||v_shouliliang||“;完成量:
”||v_wanchengliang||";超时量:"||v_chaoshiliang);
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('Not FOUND RECORD');
END;
CREATE OR REPLACE PROCEDURE p_ccrm
(v_depid ccrm_deptment.depid%type)
AS
v_shouliliang number(100);
v_wangchengliang number(100);
v_chaoshiliang number(100);
BEGIN
手渣 IF(V_DEPID=0)
THEN
select count(distinct id) shouliliang
,sum(case when workstate='已处理' or workstate='办结' then 1 else 0 end) wanchengliang
,sum(case when workendtime-workstart > XX then 1 else 0 end) chaoshiliang
into v_shouliliang,v_wanchengliang,v_chaoshiliang
from ccrm_service cs,ccrm_userlist cu,ccrm_deptment cd
where cd.depid=cs.depid
and cd.depid=cu.depid
group by deptid;
else
select count(distinct id) shouliliang
,sum(case when workstate='已处理' or workstate='办结' then 1 else 0 end) wanchengliang
,sum(case when workendtime-workstart > XX then 1 else 0 end) chaoshiliang
into v_shouliliang,v_wanchengliang,v_chaoshiliang
from ccrm_service cs,ccrm_userlist cu,ccrm_deptment cd
where cd.depid=cs.depid
and cd.depid=cu.depid
and cd.depid=v_depid
group by id;
end if;
DBMS_OUTPUT.PUT_LINE("受液罩理量:"||v_shouliliang||“;完成量:
”||v_wanchengliang||";超时量:"||v_chaoshiliang);
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('Not FOUND RECORD');
END;
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
光点科技
2023-08-15 广告
2023-08-15 广告
通常情况下,我们会按照结构模型把系统产生的数据分为三种类型:结构化数据、半结构化数据和非结构化数据。结构化数据,即行数据,是存储在数据库里,可以用二维表结构来逻辑表达实现的数据。最常见的就是数字数据和文本数据,它们可以某种标准格式存在于文件...
点击进入详情页
本回答由光点科技提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询