Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: NULLS FIRST option in CREATE INDEX?
Select * From (
select * from table where key_expr is null
union all
select * from table where key_expr is not null)
Order By 1
See if this Helps...
-- HTH Regards, Ganesh R "Alanoly J. Andrews" <alanolya_at_invera.com> wrote in message news:e76061b9.0306090430.5a7ff0b0_at_posting.google.com...Received on Mon Jun 09 2003 - 19:50:25 CDT
> "Maximus" <qweqwe_at_qwqwewq.com> wrote in message
news:<L26Ea.142907$3C2.4666777_at_news3.calgary.shaw.ca>...
> >
> > Why not just UNION ALL two selects together? This example will give you
> > nulls first without doing a sort:
> >
> > select * from table where key_expr is null
> > union all
> > select * from table where key_expr is not null
>
> Thanks...but such a union will not give me the desired order of rows.
> Consider the following rows:
> col1 col2
> ---- ----
> A NULL
> B NULL
> A abc
> B abc
>
> The order produced by your SQL will be the same as the above.
> But the order desired by my SQL ("order by col1, col2 nulls first")
> as described earlier is:
> A NULL
> A abc
> B NULL
> B abc
>
> Alanoly.
![]() |
![]() |