Short-circuit evaluation-pl/sql expressions , PL-SQL Programming

Assignment Help:

Short-Circuit Evaluation

When computing a logical expression, the PL/SQL uses short-circuit evaluation. That is, the PL/SQL stops computing the expression as soon as the result can be determined. This permits you to write the expressions that might otherwise cause an error. Now consider the following OR expression:


DECLARE
...
on_hand INTEGER;
on_order INTEGER;
BEGIN
..
IF (on_hand = 0) OR ((on_order / on_hand) < 5) THEN
...
END IF;
END;


Whenever the value of on_hand is zero, the left operand yields TRUE, so the PL/SQL require not compute the right operand. If PL/SQL were to compute both operands before applying the OR operator, the right operand would cause a division by the zero error. In any case, it is a poor programming practice to rely on the short-circuit computation.


Related Discussions:- Short-circuit evaluation-pl/sql expressions

Update the Status of an Ordere, Create a procedure named STATUS_SHIP_SP tha...

Create a procedure named STATUS_SHIP_SP that allows a company to employee in the Shipping Department to update the status of an order to add shipping information. The BB_BASKETSTAT

Using %type-declarations in sql, Using %TYPE The %TYPE attribute gives th...

Using %TYPE The %TYPE attribute gives the datatype of a variable or the database column. In the example below, the %TYPE gives the datatype of a variable: credit REAL(7,2); debi

Miller-urey''s experimental procedure, MILLER-UREY' S EXPERIMENTAL PROCEDU...

MILLER-UREY' S EXPERIMENTAL PROCEDURES - They recreated the probable conditions on the primitive earth in the laboratory. An atmosphere containing hydrogen, ammonia, me

Parameter default values, Parameter Default Values As the illustration ...

Parameter Default Values As the illustration below shows, you can initialize the IN parameters to the default values. In that way, you can pass various numbers of actual par

Exception_init pragma - pl/sql, EXCEPTION_INIT Pragma The pragma EXCEPT...

EXCEPTION_INIT Pragma The pragma EXCEPTION_INIT relates an exception name with an Oracle error number. Which allow you to refer to any internal exception by the name and to wri

PROCEDURES AND FUNCTIONS QURIES, i NEED THE QURIES TO SOME OF THE PROBLEMS ...

i NEED THE QURIES TO SOME OF THE PROBLEMS USING plsql

Implicit cursor attributes, Implicit Cursor Attributes The Implicit cur...

Implicit Cursor Attributes The Implicit cursor attributes returns the information about the execution of an INSERT, DELETE, UPDATE, or SELECT INTO statement. The cursor attribu

Parameter and keyword description - %type attribute, Parameter and Keyword ...

Parameter and Keyword Description: collection_name: This keyword identifies the index-by table, nested table, or varray formerly declared within the present scope. cu

Declarations in sql-pl/sql, Declarations in SQL Your program stores value...

Declarations in SQL Your program stores values in the variables and constants. As the program executes, the value of the variables can change, but the values constants cannot.

Rollback behavior - bulk bind performance improvement, Rollback Behavior ...

Rollback Behavior When a FORALL statement fails, the database changes are rolled back to an implicit savepoint marked before each of the SQL statement execution. The Changes t

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd