Re: pl/sql condition evaluation

From: Russ Seligman <rseligma_at_oracle.com>
Date: 31 Jul 1994 01:51:33 GMT
Message-ID: <RSELIGMA.94Jul30185133_at_seinfeld.oracle.com>


In article <Ctpz3C.GHA_at_empros.com> jderby_at_empros.com (Joel Derby) writes:
>
>Does anyone know if in evaluating a condition in say an IF statement whether
>pl/sql is smart enough to stop evaluation of a condition once it is unequivocally
>true or false, or will it allways evaluate the entire condition...
>
>for example
>
> IF (a = 1) OR (b = 2) OR (c = 3) THEN
> ..do something
> END IF;
>
>if a was equal to 1 does pl/sql not evaluate the b=2 or c=3, and just execute the
>commands in the body of the IF statement?

If a=1, the rest of the line is not evaluated.

Refer to the PL/SQL User's Guide and Reference, chapter 9 ("Language Elements"), section "Conditions", heading "Usage Notes". I can't give you a page number because I'm viewing it online using Oracle Book. ->shameless plug<-

--Russ

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

Russ Seligman                 "If there's nothing wrong with me, maybe
Oracle Corporation             there's something wrong with the universe."
rseligma_at_oracle.com              --Beverly Crusher, ST:TNG
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Received on Sun Jul 31 1994 - 03:51:33 CEST

Original text of this message