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: nvl question

Re: nvl question

From: Sydney Palmer <sydpalm_at_home.com>
Date: Sat, 30 Jun 2001 21:21:14 GMT
Message-ID: <3B3E42D0.161B@home.com>

kazelot_at_thenut.eti.pg.gda.pl wrote:
>
> On Sat, 30 Jun 2001, P.J. wrote:
> > Try this
> > select distinct tab1.col1
> > from tab1
> > order by tab1.col1 desc
>
> I'm sorry, I didn't make myself clear.
>
> > > My select returns null as the last value and I would like it to be first?
>
> I meant I want the rows ordered alphabetically AND have null listed first.
> That's why I thought about NLV.
>
> Thank you,
> kazelot

Assuming a BLANK or some other character comes before your other values, you could try:

  select distinct nvl(col1,' ')
  from tab1
  order by nvl(col1,' ');

(I think the ORDER BY is superfluous when using  DISTINCT, though, since they are probably already  ordered).

Yours,

Geoff Houck

systems hk
http://members.home.net/houckg
hksys_at_home.com Received on Sat Jun 30 2001 - 16:21:14 CDT

Original text of this message

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