加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

SQLSERVER存储过程转换oracle

发布时间:2020-12-12 15:02:09 所属栏目:MsSql教程 来源:网络整理
导读:今天帮人把一个SQL SERVER的简单存储过程改成了ORACEL的存储过程 ? --以前这个存储过程是SQL Server的,我想把它用oracle语句来,但是编译不过,有错误,请大家指教一下, create or replace p_GetPrenDataOfAtt(yymmdd1 date,empid1 number) as? RHour11 fl

今天帮人把一个SQL SERVER的简单存储过程改成了ORACEL的存储过程

?

--以前这个存储过程是SQL Server的,我想把它用oracle语句来,但是编译不过,有错误,请大家指教一下,

create or replace p_GetPrenDataOfAtt(yymmdd1 date,empid1 number)
as?
RHour11 float;
RHour21 float;
PreWTID varchar2(20);
PreLastOut number;

begin
? select PreLastOUT:=case?
? when IntGO5>-1 and IntOUT5>-1 then IntOUT5;
? when IntGO4>-1 and IntOUT4>-1 then IntOUT4;
? when IntGO3>-1 and IntOUT3>-1 then IntOUT3;
? when IntGO2>-1 and IntOUT2>-1 then IntOUT2;
? when IntGO1>-1 and IntOUT1>-1 then IntOUT1;
? end case,
? RHour11: = RHour1,RHour21: = RHour2,PreWTID:= WTID
? from AttDayData where YYMMDD =YYMMDD1 - 1 and EmpID=EmpID1;
? ?
? if PreLastOUT is null then
? PreLastOUT: = -1;
? end if;
? ?
? if PreLastOUT >1440 then
? PreLastOUT: = PreLastOUT - 1440;
? else
? PreLastOUT:= 0 ;
? end if ;
? ?
? if RHour11>0 or RHour21>0 or PreWTID is null then
? select PreWTID:=a.WTID from
? (select row_number()over(order by YYMMDD DESC) as "row",wtid from AttDayData where YYMMDD < yymmdd1 -1 and EmpID =EmpID1;)a
? where a.row=1;
? end if;
? ?
? ?
end ;

?

--------------------------

?

create or replace procedure p_GetPrenDataOfAtt(yymmdd1 date,empid1 number)
as
RHour11 float;
RHour21 float;
PreWTID varchar2(20);
PreLastOut number;

begin
? select? case
? when IntGO5>-1 and IntOUT5>-1 then IntOUT5
? when IntGO4>-1 and IntOUT4>-1 then IntOUT4
? when IntGO3>-1 and IntOUT3>-1 then IntOUT3
? when IntGO2>-1 and IntOUT2>-1 then IntOUT2
? when IntGO1>-1 and IntOUT1>-1 then IntOUT1
? end case,
? --RHour11: = RHour1,PreWTID:= WTID
? RHour1,RHour2,WTID into PreLastOUT,RHour11,RHour21,PreWTID
? from AttDayData where YYMMDD =YYMMDD1 - 1 and EmpID=EmpID1;

? if PreLastOUT is null then
? PreLastOUT:= -1;
? end if;

? if PreLastOUT >1440 then
? PreLastOUT:= PreLastOUT - 1440;
? else
? PreLastOUT:= 0 ;
? end if ;

? if RHour11>0 or RHour21>0 or PreWTID is null then
?-- select PreWTID:=a.WTID from
?select? a.WTID into PreWTID from
? (select row_number()over(order by YYMMDD DESC) as "row",wtid from AttDayData where YYMMDD < yymmdd1 -1 and EmpID =EmpID1) a
? where rownum=1;
? end if;

end ;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读