RE: Useful Oracle books - C.J. Date theory vs. practicality

  • From: "Powell, Mark D" <mark.powell@xxxxxxx>
  • To: "'oracle-l@xxxxxxxxxxxxx'" <oracle-l@xxxxxxxxxxxxx>
  • Date: Fri, 28 May 2004 15:48:24 -0400

I think the point was if part of some condition was Null then the statement
is not true, but is not false either as technically the result is unknown so
in pl/sql you potentially should have a construct that looks like
 
If true 
   ...
Else if false
  ...
Else [it is null so]
 
I have seen more than one bug traced to the failure of a developer to
remember that in pl/sql just because something is not true that does not
mean it is false.  Failure to remember this results in attempts to find rows
for the FALSE condition when there is no value to be used to query for those
rows. 
 
In native COBOL there is only True and False.  However if you use COBOL with
an RDBMS both Oracle and DB2 provide a null value indicator feature that can
be used to allow program logic to properly handle the data.  No matter what
language is used when the data comes from an RDBMS that supports NULLs this
issue of TRUE/ FALSE/ NULL probably exists.
 
Just adding to the noise level.
-- Mark D Powell --

-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx]On
Behalf Of Jared.Still@xxxxxxxxxxx
Sent: Friday, May 28, 2004 3:24 PM
To: oracle-l@xxxxxxxxxxxxx
Subject: RE: Useful Oracle books - C.J. Date theory vs. practicality




> just for fun, check out these two commands:
> 
> IF     (some condition) THEN (statement 1) ELSE (statement 2);
> IF NOT (some condition) THEN (statement 2) ELSE (statement 1);
> 
> regardless the contents of your data structures,
> in COBOL these two are equivalent but in PL/SQL they are not!

You've really lost me here. 

12:22:41 rsysdevdb.radisys.com - jkstill@dv01 SQL> 
12:22:46 rsysdevdb.radisys.com - jkstill@dv01 SQL> l 
  1  begin 
  2 
  3     if true then 
  4             dbms_output.put_line('TRUE'); 
  5     else 
  6             dbms_output.put_line('FALSE'); 
  7     end if; 
  8 
  9     if not true then 
 10             dbms_output.put_line('FALSE'); 
 11     else 
 12             dbms_output.put_line('TRUE'); 
 13     end if; 
 14 
 15* end; 
12:22:47 rsysdevdb.radisys.com - jkstill@dv01 SQL> / 
TRUE 
TRUE 

PL/SQL procedure successfully completed. 

Maybe I need a slug of Ardberg to understand. 


Jared 


Other related posts: