Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Decode- Please Help
Hi,
Try this:
SELECT
TO_DATE(
'31-DEC-'||
TO_CHAR(ADD_MONTHS(TO_DATE('15-DEC-1997','DD-MON-YYYY'),18),
'YYYY'),
'DD-MON-YYYY')
FROM DUAL;
End of the yead is always December, 31, isn't it?
Andrew Protasov
> Need to write a select statement that takes a date (eg. 15-DEC-97) and adds
> 18 months to it. It must then print out the year-end (DEC 31) of that
> addition. For example, 18 months from Dec. 15 1997 is June 15, 1999, but the
> year-end result that would be displayed is Dec. 31, 1999.
>
>
> I can write this with date functions but I need to make it more dynamic with a
> decode.
> How do I do this. I tried and tried, please help..
>
> Thanks so much for your help
Received on Wed Nov 04 1998 - 02:42:29 CST