oracle存储过程转换成sql存储过程 加游标 5
CREATEORREPLACEPROCEDUREUSP_VASCULAR_ACCESS_SITEISBEGINDECLAREV_VASCULAR_ACCESSVARCHA...
CREATE OR REPLACE PROCEDURE USP_VASCULAR_ACCESS_SITE IS
BEGIN
DECLARE
V_VASCULAR_ACCESS VARCHAR2(50);
V_ACCESS_SITE VARCHAR2(50);
BEGIN
FOR BRESULT IN (SELECT A.PATIENT_ID FROM BPIS_PATIENT_INFO A) LOOP
BEGIN
SELECT A.VASCULAR_ACCESS, A.ACCESS_SITE
INTO V_VASCULAR_ACCESS, V_ACCESS_SITE
FROM BPIS_TREAT_PROGRAM_LIST A
WHERE A.PATIENT_ID = BRESULT.PATIENT_ID
AND ROWNUM = 1;
UPDATE BPIS_PATIENT_INFO A
SET A.VASCULAR_ACCESS = V_VASCULAR_ACCESS,
A.ACCESS_SITE = V_ACCESS_SITE
WHERE A.PATIENT_ID = BRESULT.PATIENT_ID;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END LOOP;
END;
END USP_VASCULAR_ACCESS_SITE; 展开
BEGIN
DECLARE
V_VASCULAR_ACCESS VARCHAR2(50);
V_ACCESS_SITE VARCHAR2(50);
BEGIN
FOR BRESULT IN (SELECT A.PATIENT_ID FROM BPIS_PATIENT_INFO A) LOOP
BEGIN
SELECT A.VASCULAR_ACCESS, A.ACCESS_SITE
INTO V_VASCULAR_ACCESS, V_ACCESS_SITE
FROM BPIS_TREAT_PROGRAM_LIST A
WHERE A.PATIENT_ID = BRESULT.PATIENT_ID
AND ROWNUM = 1;
UPDATE BPIS_PATIENT_INFO A
SET A.VASCULAR_ACCESS = V_VASCULAR_ACCESS,
A.ACCESS_SITE = V_ACCESS_SITE
WHERE A.PATIENT_ID = BRESULT.PATIENT_ID;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END LOOP;
END;
END USP_VASCULAR_ACCESS_SITE; 展开
1个回答
2016-05-04 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
关注
展开全部
CREATE proc jiagongzi
as
declare @name nvarchar(20)
declare @xueli nvarchar(20)
declare @time datetime
declare @gongzi intdeclare zengjia cursor scroll
for
select * from 职员表
open zengjia
fetch next from zengjia into @name,@xueli,@time,@gongzi
while @@FETCH_STATUS=0
begin
if (@xueli='本科' or @xueli='硕士') and DATEDIFF(year, @time, getdate())>=3
begin
update 职员表 set 工资=@gongzi+@gongzi*0.1 where 姓名=@name
end
if (@xueli<>'本科' and @xueli<>'硕士') and DATEDIFF(year, @time, getdate())>=10
begin
update 职员表 set 工资=@gongzi+@gongzi*0.08 where 姓名=@name
end
fetch next from zengjia into @name,@xueli,@time,@gongzi
end
close zengjia
deallocate zengjia goexec jiagongzi
as
declare @name nvarchar(20)
declare @xueli nvarchar(20)
declare @time datetime
declare @gongzi intdeclare zengjia cursor scroll
for
select * from 职员表
open zengjia
fetch next from zengjia into @name,@xueli,@time,@gongzi
while @@FETCH_STATUS=0
begin
if (@xueli='本科' or @xueli='硕士') and DATEDIFF(year, @time, getdate())>=3
begin
update 职员表 set 工资=@gongzi+@gongzi*0.1 where 姓名=@name
end
if (@xueli<>'本科' and @xueli<>'硕士') and DATEDIFF(year, @time, getdate())>=10
begin
update 职员表 set 工资=@gongzi+@gongzi*0.08 where 姓名=@name
end
fetch next from zengjia into @name,@xueli,@time,@gongzi
end
close zengjia
deallocate zengjia goexec jiagongzi
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
今至电子科技有限公司
2024-08-23 广告
2024-08-23 广告
数据库备份是确保数据安全与业务连续性的关键环节。我们上海今至电子科技有限公司高度重视数据保护,定期执行全面的数据库备份策略。这包括使用先进工具和技术,对关键业务数据进行自动化备份,并存储在安全可靠的外部存储介质或云端。通过定期验证备份的完整...
点击进入详情页
本回答由今至电子科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询