Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> PL/SQL Beginner Question ...

PL/SQL Beginner Question ...

From: cdecarlo <cdecarlo_at_gmail.com>
Date: 5 Apr 2007 11:29:29 -0700
Message-ID: <1175797769.061159.81460@n76g2000hsh.googlegroups.com>


Hello,

I'm just reviewing some pl/sql code that I've been given and I was wondering if someone could educate me regarding how a pl/sql IF statement is evaluated, does it short circuit the evaluation once one truth is determined or does it evaluate the entire expression? Does it evaluate left to right or right to left?

Also, are these two blocks contextually the same? Which uses better style?

Firstly consider there are functions titled functionX where X is a number from 1 to 4, each function will return a boolean value.

IF NOT function1
  THEN IF NOT function2

      THEN IF NOT function3
           THEN IF NOT function4
                  THEN
                      statement;
                   END IF;
           END IF:
       END IF;

    END IF;
END IF; vs.

IF function1 THEN

   statement;
ELSEIF function2 THEN

   statement;
ELSEIF function3 THEN

   statement;
ELSEIF function4 THEN

   statement;
ELSE
    statement;
END IF; Thanks,

cdecarlo Received on Thu Apr 05 2007 - 13:29:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US