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
Cursor Variables Similar to a cursor, cursor variable points to the current row in the result set of a multi-row query. But, dissimilar a cursor, a cursor variable can be opene

Using a Host Variable You can declare the cursor variable in the PL/SQL host environment like an OCI or Pro C program. To use the cursor variable, you should pass it as a host

UTL_FILE: The Package UTL_FILE permits your PL/SQL programs to read & write operating system (OS) text files. It gives a restricted version of the standard OS stream file I/O,

Challenge 1 You are required to do the project and write a test plan for it. Demo 4 is a check writer program for employees. In it, the user enters all information about the

Use the RETURNING Clause Frequently, the application requires information about the row affected by a SQL operation, for illustration, to produce a report or take a subsequent

Tautologies: Above given table allows us to read the truth of the connectives in the next manner. Just expect we are looking at row three. It means this says that, if there P

Example of Using Aggregation on Nested Tables Example: How many students sat each exam WITH C_ER AS (SELECT CourseId, CAST (TABLE (SELECT DISTINCT StudentId, Mark FROM EXAM

Packaging Cursors   You can split a cursor specification from its body for placement in a package. In that way, you can change the cursor body without changing the cursor spec

I would like to have a custom MS Access database designed and coded that would help me schedule my customer's orders and that would help me track my employees production output and

Type versus Representation Confusion in SQL This describes how a value might have two or more distinct representations. For example, user-defined type POINT might have a decla