(how在Oracle中编写下面的代码)
在下面提到的oracle查询中,不想使用@dtAttendance dt中的表变量,不知道如何使用
PROCEDURE uploadShiftRoaster
(
V_ShiftName varchar2 ,
V_UpdatedBy Date DEFAULT null ,
V_TowerPk varchar2
)
as
begin
UPDATE A
SET A.ShiftName = dt.ShiftName,
A.ShiftStartTime=DATEDIFF * INTERVAL '1' dayA. AttendanceDate -'1900-01-01' +
TO_CHAR(S.ShiftStartTime (8)),
A.ShiftEndTime=DATEDIFF * INTERVAL '1' day.AttendanceDate
case when dt.ShiftName='NIGHT' then -1 else 0 end +TO_CHAR(S.ShiftEndTime (8)),
A.ModifiedBy = V_UpdatedBy,
A.ModifiedOn = systimestamp
from T_ATTENDANCE_ATTENDANCE A join @dtAttendance dt on A.LoginId = dt.LoginID and A.AttendanceDate = dt.AttendanceDate
left join T_ATTENDANCE_SHIFT_MASTER S on S.Shift=dt.ShiftName
where a.AttendanceDate between systimestamp-1 and interval '+30' day + systimestamp
and A.LoginId in (Select LoginId from T_ATTENDANCE_USER_ATTENDANCE_TEAM where TowerPk = V_TowerPk and isActive = 'Y')
end uploadShiftRoaster;
字符串
1条答案
按热度按时间lp0sw83n1#
传入集合:
字符串
其中,对于样本数据:
型
然后,如果调用该过程:
型
然后,表格将更新为:
| 日期_列|更新|
| --|--|
| 1970-01-01 00:00:00| 1 |
| 2019 -01- 22 00:00:00| 0 |
| 2019 -01-03 00:00:00| 0 |
| 2019 -01-04 00:00:00| 1 |
| 2019 -01-05 00:00:00| 1 |
fiddle