程序更新出席情况(
V_AttendanceDate DATE、V_LoginId varchar2、V_SignType varchar2、V_IpAddress varchar2、V_LogonerName VARCHAR2、V_ShiftName VARCHAR2、V_WorkLocationType VARCHAR2、V_WorkLocation VARCHAR2、V_Self_Covid_Status VARCHAR2、V_Self_Covid_Remark VARCHAR2、V_Family_Covid_Status VARCHAR2、V_Family_Covid_Remark VARCHAR2、curAttendanceDate OUT T_CURSOR
)开始
-在此部分中,我收到错误SELECT CASE WHEN SignOut IS NULL THEN INTERVAL '-1' DAY(5)+ V_AttendanceDate ELSE V_AttendanceDate END
进入V_AttendanceDate从T_ATTENDANCE_ATTENDANCE
WHERE UPPER (ShiftName) = 'NIGHT'
AND LoginId = V_LoginId
AND AttendanceDate = INTERVAL '-1' DAY (5) + V_AttendanceDate
AND V_SignType = 'SIGNOUT'
AND Active = 1;
UPDATE T_ATTENDANCE_ATTENDANCE
SET SignIn =
CASE
WHEN V_SignType = 'SIGNIN'
AND SignIn IS NULL
THEN
SYSDATE
ELSE
SignIn
END,
SignOut =
CASE
WHEN V_SignType = 'SIGNOUT'
AND signout IS NULL
THEN
SYSDATE
ELSE
SignOut
END,
IpAddress =
CASE
WHEN NVL (IpAddress, '') = '' THEN V_IPAddress
ELSE IpAddress || ',' || V_IPAddress
END,
LogonUserName =
CASE
WHEN NVL (LogonUserName, '') = '' THEN V_LogonUserName
ELSE LogonUserName || ',' || V_LogonUserName
END,
WorkLocation =
CASE
WHEN V_SignType = 'SIGNIN' THEN V_WorkLocation
ELSE WorkLocation
END,
WorkLocationType =
CASE
WHEN V_SignType = 'SIGNIN' THEN V_WorkLocationType
ELSE WorkLocationType
END,
ShiftName =
CASE
WHEN V_SignType = 'SIGNIN'
AND NVL (ShiftName, '') = ''
THEN
V_ShiftName
ELSE
ShiftName
END
WHERE AttendanceDate = V_AttendanceDate
AND LoginId = V_LoginId
AND Active = 1;
UPDATE T_ATTENDANCE_ATTENDANCE
SET ShiftName = 'LEAVE'
WHERE AttendanceDate < SYSTIMESTAMP - 2
AND SignIn IS NULL
AND SignOut IS NULL
AND ShiftName IN ('MORNING',
'AFTERNOON1',
'AFTERNOON2',
'GENERAL1',
'GENERAL2',
'NIGHT');
INSERT INTO T_ATTENDANCE_USER_COVID_STATUS (LoginId,
AttendanceDate,
Self_Covid_Status,
Self_Covid_Remark,
Family_Covid_Status,
Family_Covid_Remark,
UpdatedOn,
UpdatedBy)
SELECT V_LoginId,
V_AttendanceDate,
V_Self_Covid_Status,
V_Self_Covid_Remark,
V_Family_Covid_Status,
V_Family_Covid_Remark,
SYSTIMESTAMP,
UPPER (V_LoginId)
FROM DUAL
WHERE V_SignType = 'SIGNIN';
字符串
结束更新出席;
2条答案
按热度按时间mklgxw1f1#
在其他错误中,你不能在PL/SQL中单独使用
SELECT
语句。你需要SELECT ... [BULK COLLECT] INTO ...
。但是,你甚至不想这样做,而是应该将日历生成合并到INSERT
语句中:字符串
此外,
E.Company NOT IN ('')
和E.Company = ''
永远不会为真,因为在Oracle中,''
与NULL
相同,而Oracle使用三进制逻辑,因此E.Company NOT IN (NULL)
和E.Company = NULL
不会计算为TRUE
或FALSE
,而是,都计算为NULL
,并且由于NULL
不是TRUE
,因此逻辑的两个分支都不匹配。你想要的是使用
E.Company IS NOT NULL
和E.company IS NULL
来匹配非空和空字符串。42fyovps2#
如果您使用的是一个不错的编辑器,代码格式化程序将显示一些错误,例如
end if
修复后,代码看起来像这样,但我不知道它是否会编译,因为我们没有你的表。
字符串