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

Use the nocopy compiler hint - performance of application, Use the NOCOPY C...

Use the NOCOPY Compiler Hint By default, the OUT and IN OUT parameters are passed by the value i.e. the value of an IN OUT actual parameter is copied into the corresponding fo

Assignment 4, I need a query for PL/SQL, selecting names with cursor, goes ...

I need a query for PL/SQL, selecting names with cursor, goes down the list, assigns usernames (initials001) based on initials in the name. If two names have same initials the user

Ssrs report writing, SSRS Report Writing Project Description: This re...

SSRS Report Writing Project Description: This report is part of a larger project to make a SQL Server Reporting Service (SSRS) based reporting solution. There can be more rep

Using exists - collection methods, Using EXISTS The EXISTS(n) returns ...

Using EXISTS The EXISTS(n) returns TRUE if the nth element in a collection exist. Or else, EXISTS(n) returns FALSE. Primarily, you use EXISTS with DELETE to maintain the spars

Synonyms- naming conventions, Synonyms You can create the synonyms to pr...

Synonyms You can create the synonyms to provide location transparency for the remote schema objects like tables, views, sequences, stand-alone subprograms, and packages. Though,

Enforce security in the database system, Question: (a) In the context o...

Question: (a) In the context of database security explain how the following database features help to enforce security in the database system: (i) Authorisation (ii) Access

Iteration schemes- iterative control, Iteration Schemes The bounds of a ...

Iteration Schemes The bounds of a loop range can be variables, literals, variables, or expressions but must compute to integers. Below are some of the examples. As you can see t

Using not null-declarations in sql, Using NOT NULL Besides assigning an ...

Using NOT NULL Besides assigning an initial value, the declarations can impose the NOT NULL constraint, as the example below shows: acct_id INTEGER(4) NOT NULL := 9999; You ca

Table comparison - sql, Table Comparison - SQL The following definitio...

Table Comparison - SQL The following definitions for relation comparisons: Let r1 and r2 be relations having the same heading. Then: r1 ⊆ r2 is true if every tuple of r1

Assignment of variable - updating a variable, Assignment of Variable - Upda...

Assignment of Variable - Updating a Variable Syntax: SET SN = SID ('S2'); This can obviously be read as "set the variable SN to be equal in value to SID ( 'S2' )".

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