Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Position of NULLs in a sort

Re: Position of NULLs in a sort

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: Thu, 08 Apr 1999 17:51:00 GMT
Message-ID: <370f2391.1232604@netnews.worldnet.att.net>


On Wed, 07 Apr 1999 17:55:29 -0400, tony <tony_at_brunnet.net> wrote:

>This is counter-intuitive to me, and my client. Is there a parameter
>that can be set to reverse this, or another method? Substituting an
>extremely low value for NULL is an unacceptable solution.

Here's a bizarre approach that might work for you. Say that you need to sort on the ID column.

select ID
from your_table
order by decode(ID,null,0,1), ID;

I havn't tried this, but I think that you can sort by an expression. The decode will evaluate to zero for all nulls, and one for everything else, which should force the nulls to come first.

regards,

Jonathan Received on Thu Apr 08 1999 - 12:51:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US