Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Doubt using to_timestamp

user625850Jul 9 2012 — edited Jul 9 2012
I have a table A with Timestamp data type.

DATE1 TIMESTAMP

SELECT DATE1 FROM A

02-AUG-12 01.45.02.222000000 PM
02-AUG-12 01.45.02.222000000 PM
02-AUG-12 10.45.02.222000000 AM
02-AUG-12 01.45.02.222000000 PM

I want to add 1 year to this date and on the result I want to see the fraction as well.

But when I add 365 I am loosing the time and fraction part even after converting to TO_TIMESTAMP.


SELECT DATE1, DATE1 +365, to_timestamp(DATE1 +365,'yyyy-mm-dd hh:mi:ss.ff') FROM A

02-AUG-12 01.45.02.222000000 PM 02-AUG-13 13-AUG-02 12.00.00.000000000 AM
02-AUG-12 01.45.02.222000000 PM 02-AUG-13 13-AUG-02 12.00.00.000000000 AM
02-AUG-12 10.45.02.222000000 AM 02-AUG-13 13-AUG-02 12.00.00.000000000 AM
02-AUG-12 01.45.02.222000000 PM 02-AUG-13 13-AUG-02 12.00.00.000000000 AM


Is there a way I can add 1 year to date and yet see the fraction part of the date?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 6 2012
Added on Jul 9 2012
7 comments
232 views