Rephrase conditional control statements, PL-SQL Programming

Rephrase Conditional Control Statements

When computing a logical expression, the PL/SQL uses short-circuit evaluation. That is, the PL/SQL stops evaluating the expression as soon as the result can be determined. For illustration, in the OR expression below, when the value of sal is less than 1500, the left operand yields TRUE, Therefore PL/SQL need not evaluate the right operand (as OR returns TRUE if either of its operands is true):

IF (sal < 1500) OR (comm IS NULL) THEN

...

END IF;

Now, consider the AND expression shown below:

 

IF credit_ok(cust_id) AND (loan < 5000) THEN

...

END IF;

The Boolean function credit_ok is forever called. Though, if you switch the operands of AND as shown:

 

IF (loan < 5000) AND credit_ok(cust_id) THEN

...

END IF;

The function is called only if the expression loan < 5000 is true (as AND returns TRUE only if both its operands are true). The similar idea applies to the EXIT-WHEN statements.

Posted Date: 10/5/2012 5:01:48 AM | Location : United States







Related Discussions:- Rephrase conditional control statements, Assignment Help, Ask Question on Rephrase conditional control statements, Get Answer, Expert's Help, Rephrase conditional control statements Discussions

Write discussion on Rephrase conditional control statements
Your posts are moderated
Related Questions
%ISOPEN The Oracle closes the SQL cursor automatically after executing its related SQL statement. As a result, the %ISOPEN forever yields FALSE.

Authorisations - Privileges As relational theory is silent on the issue of authorisation, it offers nothing with which SQL's vast edifice in support of what it calls privilege

Multiple Assignment- SQL SQL supports multiple assignment to local variables and also applies multiple assignment semantics in SET clauses of UPDATE statements, but does not

BETWEEN Operator The operator BETWEEN, tests whether the value lies in a specified series. That means "greater than or equivalent to low value and less than or equivalent to hig

Using raise_application_error The Package DBMS_STANDARD that is supplied with Oracle gives language facilities that help your application to interact with Oracle. For illustra

Substitution and Instantiation - SQL It shows how NULL might appear in substitution for a parameter of a predicate and how it might thus participate in instantiation of that p

Using Operator VALUE: As you may expect, the operator VALUE returns the value of an object. The VALUE takes its argument a correlation variable.  For illustration, to return a

Declaring and Initializing Objects: An object type is once defined and installed in the schema; you can use it to declare the objects in any PL/SQL, subprogram, block or packa

Lightweight system to provide and take info from workers in the field and office, have basic design outlined already just require build and implementation Desired Skills CSS,

Predefined Exceptions The internal exception is raised implicitly whenever your PL/SQL program exceeds a system-dependent limit or violates an Oracle rule. Each & every Oracle