default 0 vs. null [message #54258] |
Thu, 07 November 2002 03:59 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sudatta
Messages: 2 Registered: September 2002
|
Junior Member |
|
|
i have table with 260 columns(number (9)).for each row half the columns (different columns for different rows)have no value i.e. zero...
my question is
should i use default 0 at the time of creation of table
or
let it be null
.the first method makes my quries/plsql simpler as i don't have to use nvl....
|
|
|
Re: default 0 vs. null [message #54266 is a reply to message #54258] |
Thu, 07 November 2002 12:24 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
0 is very different to null. If 0 is a valid value (it means something to the business) then you need to be able to distinguish between when the value is known and when it is not. You should not put 0 into a table simply to make display easier.
|
|
|
Re: default 0 vs. null [message #54291 is a reply to message #54258] |
Fri, 08 November 2002 13:00 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
Trifon Anguelov
Messages: 514 Registered: June 2002
|
Senior Member |
|
|
"have no value i.e. zero..."
Oracle doesn't think like that. Having no value is the NULL, which means the value is unknown, might be -1, 1,000,000, infinity, anything. The 0 on the other side is fixed number. Two separate values.
IMHO, when creating the table - let the value be NULL (default when values are not inserted). Then in your queries can subset by WHERE column IS NULL, which of course will not use any index you have on this column. So it's your choice....
Hope that helps,
clio_usa
OCP - DBA
Visit our Web site
|
|
|