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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Can in anyway use LEAST () with a null value???

Re: Can in anyway use LEAST () with a null value???

From: Alexei VORONOV <alexei_voronov_at_yahoo.com>
Date: Fri, 2 Nov 2001 13:43:49 +0100
Message-ID: <9ru4as$fb5$1@wanadoo.fr>


You can use this statement, but it is also long:

select min(d) into date_min from (

  select date_1 AS d from DUAL union
  select date_2 from DUAL union
  select date_3 from DUAL union
  select date_4 from DUAL);

"Bliss" <bliss_is_ignorance_at_hotmail.com> a écrit dans le message news: 3be18f2d_2_at_news.tm.net.my...
> Hi all,
>
> In a PL/SQL block I have four date type variables.... At any given point
of
> time atleast one variable will have some data in it, the other three may
> have values or may be null e.g.
>
> date_1 := '01-may-2001';
> date_2 := null;
> date_3 := '01-sep-2001';
> date_4 := '01-jan-2001';
>
> I have to find the lowest amongst these dates... I can't use LEAST ()
> because of the null value... I've tried racking my brains (??!!!) will all
> kind of combination of NVL () and DECODE () with LEAST ()... but could not
> get a solution... So finally I stuck to good 'ol IF..THEN... However I
have
> a great feeling that I'm missing out on something... There must be some
way
> to get the lowest value using LEAST () and taking care of the nulls... Any
> suggestions anyone????
>
> Thanks for your attention....
>
> Regards,
> Bliss
>
>
Received on Fri Nov 02 2001 - 06:43:49 CST

Original text of this message

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