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
Built-In Functions The PL/SQL provides a lot of powerful functions to help you to manipulate the data. These built-in functions fall into the categories as shown below: error r

Operators on Tables and Rows Row Extraction TUPLE FROM r, SQL has row subqueries. These are just like scalar subqueries except that they may specify more than one column.

Variable Declaration - SQL SQL's support for variables is very similar to Tutorial D's, except that the syntax for creating persistent  variables-base tables-is quite differen

Product-specific Packages The Oracle and different Oracle tools are supplied with the product-specific packages which help you to build the PL/SQL-based applications. For illu

Data Types and Representations This explains the concept possible representation, abbreviated possrep, and explains how these can be used in conjunction with constraints to de

Referencing Records Unlike the elements in a collection, that are accessed using subscripts, the fields in a record are accessed by name. To reference an individual field, you

Boolean Values Only the values TRUE, FALSE, & NULL can be assigned to a Boolean variable. For illustration, given the declaration DECLARE done BOOLEAN; the following statements

IN Mode An IN parameter pass the values to the subprogram being called. Within the subprogram, an IN parameter acts like a constant. And hence, it cannot be assigned a value.

Methods: In normal, a method is a subprogram declared in an object type specification using the keyword MEMBER or STATIC. The method cannot have similar name as the object typ

Question: (a) The objective of query optimization is to choose the most efficient strategy for implementing a given relational query, thereby improving the system performance. On