Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: No Nulls? (was: Warehouse design: snowflake vs star schemas)
Rich,
NULLs are one of those religious war topics.
They have a legitimate place in an RDBMS, but I think you need to be judicious in using them.
If a column is to be used as part of a where clause, I prefer to use a default value, particularly with dates.
NULLs can be a real performance killer when used this way.
Here's an example where a begin date is known, the end date may be specifed or not. If not, it is NULL.
NULL:
select *
from mytab
where begin_date >= to_date('06/18/2001','mm/dd/yyyy')
and (
end_date <= ' to_date('08/30/2001','mm/dd/yyyy')
or
end_date is NULL
)
The problem with that one is obvious. The SQL is a little convoluted and it's going to be slow due to the NULL.
DEFAULT VALUE of 12/31/4712 for unknown or unspecified end_date:
select *
from mytab
where begin_date >= to_date('06/18/2001','mm/dd/yyyy')
and (
end_date <= ' to_date('08/30/2001','mm/dd/yyyy')
or
end_date = to_date('12/31/4712','mm/dd/yyyy')
)
Jared
"Jesse, Rich" <Rich.Jesse_at_qtiworld.com>
Sent by: root_at_fatcity.com
10/14/2002 10:33 AM
Please respond to ORACLE-L
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc: Subject: No Nulls? (was: Warehouse design: snowflake vs star schemas)
On the link below is this quote from C.J.Date:
"I don't want you to think that my SQL solution to your problem means I advocate the use of nulls. Nulls are a disaster."
Of course, he doesn't expound upon it (probably not a need except for dummies like me). Anyone care to comment? (On the quote, not on my dumminess...)
Rich
Rich Jesse System/Database Administrator Rich.Jesse_at_qtiworld.com Quad/Tech International, Sussex, WIUSA
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Jesse, Rich INET: Rich.Jesse_at_qtiworld.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Jared.Still_at_radisys.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Mon Oct 14 2002 - 13:53:56 CDT
![]() |
![]() |