我想在执行IF
运算符之前设置AND
语句。
例如:
PROCEDURE STORE_SIGNLOOP_APPROVER
(
userID in varchar2
isManager in varchar2
result out ref_cursor
)
AS
BEGIN
SELECT user_role
FROM users
WHERE user_id = userID
AND **IF isManager = 'true'** user_id IN (SELECT user id from managers)
END;
答案 0 :(得分:1)
您可以使用:
select user_role
fron users
where user_id = userID
AND (((user_id in (select user_id from managers) AND isManager = 'true'))
OR isManager = 'false'
);
注意:而不是传递' true / false'作为字符串文字你可以使用' 0/1'值。