Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Between function in Decode statement
> I would tackle this as follows using something like:
>
> DECODE ( CEIL ( ROUND ( SYSDATE - REQUEST_LOG_DATE ) / 30 ),
> 1, NULL,
> 2, 30,
> 3, 60,
> 4, 90,
> 120 )
>
> I can't be bothered to test this, as you might need to tweak the
> boundaries a bit with - or + 1 here and there, but it should probably
> work as is.
>
Saeed, this is great! Thanks a lot.
It works perfectly, I know ideally I should tweak it to reflect months that end with 30 or 31 days but for the purposes of my query, I am happy with the results I get.
It was frustrating because I had tried CASE as some folks had suggested but it has the same limitations that decode has with relational operators. Received on Mon Jan 05 2004 - 09:32:31 CST
![]() |
![]() |