Oracle and Sorting Null Values - everyone thinks different - everyone is correct
Oracle and Sorting Null Values - everyone thinks different - everyone is correct
- Subject: Oracle and Sorting Null Values - everyone thinks different - everyone is correct
- From: email@hidden
- Date: Mon, 11 Jan 2010 10:29:42 -0500
Hi Dave,
You asked if null should be universally
"less than" non-null.
No, everyone thinks differently.
For us it is the opposite. We use Oracle
and like the way it sorts. We want "null" to be greater than
"non-null". That is because for our domain we want to see values
that have something "in them" first and for those with interesting
values to be sorted ascending. "Empty" values should be at the
end of the list.
We use Oracle and left it alone. We
decided to "fix" WO by making a "NullsAtEndComparisonSupport"
class and then at application startup use a line like so:
EOSortOrdering.ComparisonSupport.setSupportForClass(new
NullsAtEndComparisonSupport(), Object.class);
EOSortOrdering.ComparisonSupport.setSupportForClass(new
NullsAtEndComparisonSupport(), String.class);
Note 1: We had to do those lines "after"
invoking "ERXLocalizer.currentLocalizer();"
In summary, it doesn't matter if you
"fix" the DB or you fix the in-memory sorting as we have done.
What matters is that you realize there can be differences and you have
full control over how you want sorting to work no matter what DB you use.
Cheers,
-- Aaron
> Is there general consensus that the way sorting
_should_ work
> is that null is considered to be less-than non-null?
>
> Dave _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden