Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Order By
Excellent german...quote from the manual (8.1.6):
"Oracle sorts nulls following all others in ascending order and preceding
all others in descending order. ASC | DESC specifies the ordering
sequence. ASC is the default.
NULLS FIRST | NULLS LAST specifies whether returned rows containing null
values should appear first or last in the ordering sequence. NULLS LAST is
the default for ascending order, and NULLS FIRST is the default for
descending order."
So:
select ename, mgr from emp order by mgr; -- King is the last record
retrieved
select ename, mgr from emp order by mgr nulls first; -- King is the first
record retrieved
Everything clear now?
Klaus
"Mike Dwyer" <dwyermj_at_co,larimer.co.us> schrieb im Newsbeitrag
news:yZXo5.4$VK3.205_at_wdc-read-01.qwest.net...
> was bedeuten sie?* order by sorts nulls last unless you use 'desc'. But,
> then, other values are also sorted in descending sequence. Use:
>
> order by decode( the_column, null,' ', the_column)
>
> If the_column is numeric, use 0 instead of ' '.
>
> * criticism of my German is welcome :-)
>
> "Klaus Zeuch" <KZeuch_at_hotmail.com> wrote in message
> news:8o1eil$fse$15$1_at_news.t-online.com...
> > ..order by ... nulls first
> > <afedirko_at_my-deja.com> schrieb im Newsbeitrag
> > news:8o18sc$8ss$1_at_nnrp1.deja.com...
> > > Is there a way to get Oracle to return rows with nulls before rows
with
> > > characters in the Order By clause besides replacing the nulls with a
> > > space character?
> > >
> > >
> > >
> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.
> >
> >
>
>
Received on Thu Aug 24 2000 - 03:44:17 CDT
![]() |
![]() |