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
I need SQL Data Base Project Description: Network SQL database and SQL Setup two 4 workstation Skills required are Data Entry, MySQL, SQL

UPDATE Command- SQL Loosely speaking, UPDATE changes some of the column values of some existing rows of its target table. Thus, although some rows disappear from the target an

Using a Join on 2 tables, select all columns and all rows from the tables without the use of a Cartesian product. Query: SELECT * FROM EMPLOYEE1 JOIN CONTRACT ON EMPLOYEE

write the program for traffic control system with 10 second, 15 secod, and 20 second delay

PPD , CPA, Filesharing Site Project Description: This is very easy I need a PPD , CPA, Filesharing Site. [PPD] stands for (pay per download) example hotsharecash [Files

Creating and Destroying Base Tables: Example shows an SQL command to create the base table counterpart of the ENROLMENT variable Example  Creating a base table. CREATE T

Avoid the NOT NULL Constraint In the PL/SQL, using the NOT NULL constraint incur a performance cost. Consider the illustration as shown below: PROCEDURE calc_m IS m NUMB

Need for Dynamic SQL: You need dynamic SQL in the situations as follows: 1) You would like to execute a SQL data definition statement (like CREATE), a data control statemen

COMMIT Statement The COMMIT statement explicitly makes everlasting changes to the database during the present transaction. The Changes made to the database are not considered e

Using DELETE This process has three forms. The DELETE removes all elements from the collection. DELETE(n) removes the nth element from the nested table. When n is null, then D