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

Home -> Community -> Usenet -> c.d.o.tools -> Re: how to select NULL first

Re: how to select NULL first

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Mon, 7 May 2001 16:53:08 +0100
Message-ID: <989250598.22285.0.nnrp-10.9e984b29@news.demon.co.uk>

There is a recent addition to the ORDER BY syntax:

    nulls first
or

    nulls last

e.g.

    order by

        n1 nulls first,
        n2 nulls last

;
--
Jonathan Lewis
Yet another Oracle-related web site:  http://www.jlcomp.demon.co.uk

Practical Oracle 8i:  Building Efficient Databases
Publishers:  Addison-Wesley

Reviews at: http://www.jlcomp.demon.co.uk/book_rev.html



Edward Rusu wrote in message <3af6c051_at_smtp2.softcomputer.com>...

>Hi All,
>
>Let's assume that we have a table A, columns c1, c2,.. with index c1. If
you
>run a select:
>
>select * from A order by c1;
>
>rows with NULL value of c1 will be listed at the end. Is it possible to
>configure Oracle to have NULLs listed first?
>
>We already tried:
>
>select * from A order by 'A'||c1;
>
>but it is not good. It does sort in the right order but sometimes it makes
>Oracle crazy. It incorectly choses executuion path and query takes
>forever.... :-(
>
>Any advise?
>
>
>
>Thanks,
>
>Ed
>
>
>
Received on Mon May 07 2001 - 10:53:08 CDT

Original text of this message

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