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???
"Bliss" <bliss_is_ignorance_at_hotmail.com> wrote in 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
>
>
Looks like you need something along the lines
of
nvl(date_2,to_date('01-01-4711','dd-mm-yyyy'))
where 01-01-4711 is the highest date possible. I use this as +infinite date.
Hth,
-- Sybrand Bakker Senior Oracle DBA to reply remove '-verwijderdit' from my e-mail addressReceived on Thu Nov 01 2001 - 12:43:44 CST
![]() |
![]() |