Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Can in anyway use LEAST () with a null value???
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
![]() |
![]() |