Effects of null operator, PL-SQL Programming

Effects of NULL Operator

As a general rule-but not a universal one-if NULL is an argument to an invocation of a system-defined read-only operator, then NULL is the result of that invocation. As you can see, the code for HIGHER_OF includes A > B, an invocation of the system-defined read-only operator ">", which does follow the general rule. Hence, if NULL is substituted for either or both of the parameters A and B, then NULL- which in this case we can also call UNKNOWN because ">" is a Boolean operator-is the result of the invocation. You are perhaps now wondering how SQL handles the IF statement when the specified condition yields UNKNOWN: is the THEN clause evaluated, or is it the ELSE clause?

As you know, other programming languages are normally based on classical logic. In keeping with the existence of just two truth values, TRUE and FALSE, the syntax for IF statements (and IF expressions) in such languages has just the two forks, THEN for when the condition is TRUE, ELSE for when it is not (i.e., is FALSE). You might therefore reasonably expect a language that embraces n truth values to support a variety of IF that has n forks-under a language design principle that Fred Brooks referred to as conceptual integrity, which means adhering rigorously to the language's adopted concepts. Instead, SQL retains just the two forks, keeping the normal treatment of THEN as being the one for when the condition is TRUE and arbitrarily lumping UNKNOWN in with FALSE for the ELSE fork. You should now be able to see that the general rule ("NULL in, NULL out") for system-defined operators cannot be said to apply to user-defined ones. If A > B evaluates to UNKNOWN, then the result of the HIGHER_OF invocation is the argument substituted for B, which might or might not be NULL.

Posted Date: 1/18/2013 1:52:14 AM | Location : United States







Related Discussions:- Effects of null operator, Assignment Help, Ask Question on Effects of null operator, Get Answer, Expert's Help, Effects of null operator Discussions

Write discussion on Effects of null operator
Your posts are moderated
Related Questions
Parameter and Keyword Description: procedure_name The user-defined procedure is declared by this construct. parameter_name: This identifies the formal parameter t

Collections:   The collection is an ordered group of elements, all of similar type (for illustration, the grades for a class of students). Each element has an exclusive subsc

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

Obtaining a natural join by specifying the common columns Synatax: SELECT * FROM IS_CALLED JOIN IS_ENROLLED_ON USING ( StudentId ) However, a named columns join doe

THEO R Y OF CATASTROPHISM OR CATALYSM (CUVIER 1769-1832) - The world has passed thorugh several stages and at the end of each stage there was a catastrophe killing all the

Using DEFAULT You can use the keyword DEFAULT rather than that of the assignment operator to initialize the variables. For e.g. the declaration blood_type CHAR := ’O’; it can b

Initializing Records The illustration below shows that you can initialize a record in its type definition. Whenever you declare a record of the type TimeRec, its 3 fields supp

Opening a Cursor Opening the cursor executes the query & identifies the result set that consists of all rows that meet the query search criteria. For the cursors declared usin

Need Azure CRM Web Application with two-factor authentication We presently have a CRM-like database stored on MS Azure that we presently access over an MS Access application. It

a. Write an anonymous block that contains a PL/SQL function. Given an order number orderNo, the function will calculate the total number of the parts in the order. Then the anonym