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: Between function in Decode statement

Re: Between function in Decode statement

From: DFN <Iam_at_cyberspace.net>
Date: Mon, 5 Jan 2004 10:32:31 -0500
Message-ID: <btc034$5f37s$1@ID-157477.news.uni-berlin.de>


> 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

Original text of this message

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