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!

Simple Dates Subtraction

958205Aug 27 2012 — edited Aug 27 2012
Hello guis, i'm new here. I'm studying for iz0-051 certification exam and I would really appreciate if you can help me out with this doubt i have..

I know that a character literal can be implicitly converted to a date if it follows the mask '[dd,DD] separator [mm,MM,Mon] separator [yy,rr,yyyy] etc..etc...
then.. why doesn't this simple subtraction go through (number of days between a certain date and the current sysdate)?

select sysdate - '01-jan-2012' from dual;

it gives "ora-01722 invalid number" error, shouldn't it implicitly convert the literal to a date and then subtract it from sysdate? what am I doing wrong?

thanks for your help,

Paolo
This post has been answered by jeneesh on Aug 27 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 24 2012
Added on Aug 27 2012
12 comments
1,689 views