Does Oracle use short-circuit evaluation?

前端 未结 4 456
庸人自扰
庸人自扰 2020-11-28 13:00

I have an Oracle query that is structured as followed:

SELECT   *
FROM     table
WHERE    X=\'true\' OR
         Y IN (complicated subquery)
<
4条回答
  •  感情败类
    2020-11-28 13:31

    I came here looking for an answer on how to avoid crashing using short circuit evaluation. What I eventually got working is:

    ...
    where case when [its not going to crash] 
               then [short circuit expression] 
               else [safe, never used value] 
           end = comparison_value
    ...
    

    So, for example, if you are worried about a to_number expression crashing, you would put something like "REGEXP_LIKE(my_possible_number, '^[[:digit:]]+$')" in the when clause (for positive integers - adjust for non-positive or non-integer).

提交回复
热议问题