• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Oracle and Sorting Null Values - everyone thinks different - everyone is correct
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Oracle and Sorting Null Values - everyone thinks different - everyone is correct
      • From: David Avendasora <email@hidden>
  • Prev by Date: [MEET] Toronto Cocoaheads / tacow - January 26
  • Next by Date: Re: Objects don't get initialized sometimes
  • Previous by thread: [MEET] Toronto Cocoaheads / tacow - January 26
  • Next by thread: Re: Oracle and Sorting Null Values - everyone thinks different - everyone is correct
  • Index(es):
    • Date
    • Thread