Plsql PL/SQL过程具有多个“和”条件和/或条件。如何确保它执行的所有条件?

Plsql PL/SQL过程具有多个“和”条件和/或条件。如何确保它执行的所有条件?,plsql,Plsql,您需要记住两个简单的规则,逻辑运算符的关联性始终是从左到右,正确使用括号时要考虑问题的逻辑,例如: *where (citiStatus NOT IN ('Paid Off' ,'PAID-O')) and ( revolver = 0 and ( (commitmentDate = '') or ( (

您需要记住两个简单的规则,逻辑运算符的关联性始终是从左到右,正确使用括号时要考虑问题的逻辑,例如:

*where  (citiStatus NOT IN ('Paid Off' ,'PAID-O'))
    and (
            revolver = 0
                and (
                    (commitmentDate = '')
                    or (
                        (commitmentDate != '')
                        and (@currentDate < DATEADD(day, @noofDays, commitmentDate))
                        )
                    )   
        )   // until here should verify with where condition . even if it is failed or not should execute next statement .
    and (citiStatus NOT IN ('CANCELLED','Cancelled/Dead') or @currentMonth = MONTH(statusModifiedDate))-- this is will if above AND condition fails even if its true(but this should execute even to filter data).*
首先我们计算3=3真->1=2假->计算或运算符真或假->真 第二个1=1真->求值和运算符->真和真->真 如果为真,则为1

我的建议是始终使用括号,以这种方式,您将计算整个表达式,例如,不逐个标记

select case when 1=1 and 1=2 or 3=3 then 1 else 0 end as result from dual;--result 1

在有人否决你的问题之前,请展开并澄清你的问题。你的问题中的PLSQL标签是什么?它与Oracle有关,但是-您编写的代码不是Oracle。如果是何处条件,我应该如何评估?您应该使用问题的逻辑。当1=1和2=2或3=3和5=6时,选择1作为dual的结果,否则0结束=1-1.
select case when ((1=1 and 2=2) or 3=3) and 5=6 then 1 else 0 end as result from dual; --0

select case when (1=1 and 2=2) or (3=3 and 5=6) then 1 else 0 end as result from dual;  --1