Convert Day to Date in oracle
If user has some number between 1 and 31, He can convert that number to Date
Syntax:
to_date(day,fmt)
SQL> select to_date(2,'dd') from dual;
TO_DATE(2,'DD')
--------------------
02-MAY-2014
--------------------
02-MAY-2014
SQL> select to_date(31,'dd') from dual;
TO_DATE(31,'DD')
--------------------
--------------------
31-MAY-2014
If number exceeds 31. or less than 1, user gets following error message.
ERROR at line 1:
ORA-01847: day of month must be between 1 and last day of month
ORA-01847: day of month must be between 1 and last day of month
Tags: Convert day to date,convert day to Date using To_Date function,oracle convert day to date ,
oracle convert day to date using to_date,
oracle convert day to current month date.
oracle convert day to date using to_date,
oracle convert day to current month date.
No comments:
Post a Comment