|
Oracle and NULL
Last post 09-13-2005 11:55 AM by x002548. 19 replies.
-
12-09-2004 3:26 PM
|
|
-
-
-
-
-
-
-
Katja


- Joined on 11-30-2004
- Amsterdam
- Posts 298
|
Maybe it should be: SELECT * FROM SM_STPD_TB WHERE SM_STPD_CD != 'XYZ' OR SM_STPD_CD IS NULL Then again, I'm no professional Oracle DBA so what do I know about it...
With kind regards, X Katja Bergman.
|
|
-
-
Valeri


- Joined on 12-08-2004
- Posts 4
|
|
-
-
-
-
-
-
rpresser


- Joined on 12-13-2004
- Posts 17
|
Alex Papadimoulis wrote: | Whoops -- typo in the original post. replace AND with OR.
But still, it's pretty stupid that you need to put that clause in anyway. Any value that is not 'XYZ' should include values that are NULL as well. |
|
But you didn't ask for "any value that is not 'XYZ'". You asked for "All values that are not-equal-to 'XYZ'". This would be "any value that is not 'XYZ'":
SELECT * FROM SM_STPD_TB WHERE NOT SM_STPD_CD = 'XYZ'
And as usual, this isn't just Oracle, it's all SQL.
The problem is that relational logic is not a two-valued, boolean logic. The middle is not excluded. It's not "you're either for us, or against us."
Suppose I asked you to list the names of all people in your family who prefer haggis to blood pudding. I think there's a fair chance that such a question would *not* be the same as asking for the names of all people who do not prefer blood pudding to haggis. There very likely are people who hate both concoctions equally; there very likely are people who have never tasted either and hence have no opinion.
|
|
-
-
monsterinc


- Joined on 12-03-2004
- Posts 1
|
Oh, what a mastermind this Alex is!
Not only that he has no experience using plain and simple SQL
he is shouting all over about it and how much Oracle sucks.
More suck to come on this stupid forum of ignorant people and
I'll be here when another great discovery from "I hate Oracle" geniuses
comes.
|
|
-
-
Ben Hutchings


- Joined on 11-23-2004
- Cambridge, UK
- Posts 47
|
rpresser wrote: | Alex Papadimoulis wrote: | Whoops -- typo in the original post. replace AND with OR.
But still, it's pretty stupid that you need to put that clause in anyway. Any value that is not 'XYZ' should include values that are NULL as well. |
|
But you didn't ask for "any value that is not 'XYZ'". You asked for "All values that are not-equal-to 'XYZ'". This would be "any value that is not 'XYZ'":
SELECT * FROM SM_STPD_TB WHERE NOT SM_STPD_CD = 'XYZ'
And as usual, this isn't just Oracle, it's all SQL.
The problem is that relational logic is not a two-valued, boolean logic. The middle is not excluded. It's not "you're either for us, or against us."
Suppose I asked you to list the names of all people in your family who prefer haggis to blood pudding. I think there's a fair chance that such a question would *not* be the same as asking for the names of all people who do not prefer blood pudding to haggis. There very likely are people who hate both concoctions equally; there very likely are people who have never tasted either and hence have no opinion. |
|
|
|
-
-
Ben Hutchings


- Joined on 11-23-2004
- Cambridge, UK
- Posts 47
|
rpresser wrote: | The problem is that relational logic is not a two-valued, boolean logic. The middle is not excluded. It's not "you're either for us, or against us."
|
|
I'll have to take issue with your use of "relational" there. Relational theory doesn't have NULLs, because NULL is a non-value indicating a missing relation. SQL includes NULLs as a kluge to allow incompletely normalised data, and I agree that that results in a need for three-valued logic (among many other unpleasant complications).
On an unrelated note, the editing widget is broken in Firefox. Pressing "Post" always posts the original text - hence my last comment and the many others that quote comments in full but add nothing.
|
|
-
-
-
-
Foon


- Joined on 01-12-2005
- Posts 35
|
"In all database models that I know, NULL means there is no data in the field."
It means a bit more than that. Relational database theory is based on the idea that a table row is a set of "tuples". IOW: a database row is (mathematicaly speaking) a mapping of keys (the column names) to values (the contents).
A NULL does not mean "the value of this column is null". It means "this column is not there at all". It means that the map that is that row does not even have that column name as a key.
So, yes, a NULL does mean a mystical unknown. It's not a value - it is the absence of a value.
|
|
-
-
x002548


- Joined on 08-23-2005
- Posts 3
|
mkbosmans wrote: | |
Hey, Thanks for the plug...noticed the trackbacks...
|
|
Page 1 of 1 (20 items)
|
|
|