Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Useful Oracle books - C.J. Date theory vs. practicality

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

From: Lex de Haan <lex.de.haan_at_naturaljoin.nl>
Date: Fri, 28 May 2004 21:56:08 +0200
Message-ID: <JFEEIGBIDOCCDALDIPLNCEOPCDAA.lex.de.haan@naturaljoin.nl>


Jared, I stored your example in a script, making it prompt for a condition:

SQL*Plus: Release 10.1.0.2.0 - Production on Fri May 28 21:51:24 2004 Copyright (c) 1982, 2004, Oracle. All rights reserved.

SQL> @jared
Enter value for condition: 'Mort subite' = NULL ELSE branch
ELSE branch

PL/SQL procedure successfully completed.

SQL> @jared
Enter value for condition: 1=1
THEN branch
ELSE branch

PL/SQL procedure successfully completed.

SQL> list
  1 begin

  2    if     (&&condition) then
  3           dbms_output.put_line('THEN branch');
  4    else
  5           dbms_output.put_line('ELSE branch');
  6 end if;
  7 if not (&condition) then
  8 dbms_output.put_line('THEN branch');   9 else
 10 dbms_output.put_line('ELSE branch');  11 end if;
 12* end;
SQL> Kind regards,
Lex.

visit my website at http://www.naturaljoin.nl

-----Original Message-----

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Powell, Mark D
Sent: Friday, May 28, 2004 20:48
To: 'oracle-l_at_freelists.org'
Subject: RE: Useful Oracle books - C.J. Date theory vs. practicality

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 --




Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--

Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
Received on Fri May 28 2004 - 14:53:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US