Oracle数据库存储过程转化为SQL Server存储过程 在线等!!!
Orarle数据库存储过程如下:怎么转化为SQLServer存储过程!createorreplaceprocedureproc_getPayDetail(dtmvarch...
Orarle数据库存储过程如下:怎么转化为SQL Server存储过程!
create or replace procedure proc_getPayDetail
(
dtm varchar2,
resultset out sys_refcursor
)
as
begin
open resultset for
'select
emp.empid,
emp.ename,
emp.basepay,
case
when (select sum(hours*20) from tb_overtime where emptid=emp.id and
to_char(overtimedtm,''yyyy-mm'')=:dtm) is null then 0
else (select sum(hours*20) from tb_overtime where emptid=emp.id and
to_char(overtimedtm,''yyyy-mm'')=:dtm)
end overtimepay, -- 获得加班费用,规定加班每小时 20 元
case
when (select sum(days*case when personalleavetype=0 then 100 else 20 end) from
tb_personalleave where emptid=emp.id and to_char(personalleavedtm,''yyyy-mm'')=:dtm)
is null then 0
else (select sum(days*case when personalleavetype=0 then 100 else 20 end) from
tb_personalleave where emptid=emp.id and to_char(personalleavedtm,''yyyy-mm'')=:dtm)
end personalleavepay , -- 获得请假费用,规定,事假每天 100 元,病假每天 20 元
case
when (select sum(days*150) from tb_absence where emptid=emp.id and
to_char(absenceDtm,''yyyy-mm'')=:dtm) is null then 0
else (select sum(days*150) from tb_absence where emptid=emp.id and
to_char(absenceDtm,''yyyy-mm'')=:dtm)
end absencepay ---- 获得旷工扣除费用,规定旷工一天 150 元
from tb_emp emp' using dtm,dtm,dtm,dtm,dtm,dtm;
end; 展开
create or replace procedure proc_getPayDetail
(
dtm varchar2,
resultset out sys_refcursor
)
as
begin
open resultset for
'select
emp.empid,
emp.ename,
emp.basepay,
case
when (select sum(hours*20) from tb_overtime where emptid=emp.id and
to_char(overtimedtm,''yyyy-mm'')=:dtm) is null then 0
else (select sum(hours*20) from tb_overtime where emptid=emp.id and
to_char(overtimedtm,''yyyy-mm'')=:dtm)
end overtimepay, -- 获得加班费用,规定加班每小时 20 元
case
when (select sum(days*case when personalleavetype=0 then 100 else 20 end) from
tb_personalleave where emptid=emp.id and to_char(personalleavedtm,''yyyy-mm'')=:dtm)
is null then 0
else (select sum(days*case when personalleavetype=0 then 100 else 20 end) from
tb_personalleave where emptid=emp.id and to_char(personalleavedtm,''yyyy-mm'')=:dtm)
end personalleavepay , -- 获得请假费用,规定,事假每天 100 元,病假每天 20 元
case
when (select sum(days*150) from tb_absence where emptid=emp.id and
to_char(absenceDtm,''yyyy-mm'')=:dtm) is null then 0
else (select sum(days*150) from tb_absence where emptid=emp.id and
to_char(absenceDtm,''yyyy-mm'')=:dtm)
end absencepay ---- 获得旷工扣除费用,规定旷工一天 150 元
from tb_emp emp' using dtm,dtm,dtm,dtm,dtm,dtm;
end; 展开
2个回答
今至电子科技有限公司
2024-08-23 广告
2024-08-23 广告
数据库备份是确保数据安全与业务连续性的关键环节。我们上海今至电子科技有限公司高度重视数据保护,定期执行全面的数据库备份策略。这包括使用先进工具和技术,对关键业务数据进行自动化备份,并存储在安全可靠的外部存储介质或云端。通过定期验证备份的完整...
点击进入详情页
本回答由今至电子科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询