Convert Year to Date in oracle
If user has number,That number can Date .
Syntax:
to_date(year,fmt)
2-digit year
SQL> select to_date(12,'yy') from dual;
TO_DATE(12,'yy')
--------------------
01-FEB-2012
--------------------
01-FEB-2012
It has current month and start of the Month
SQL> select to_date(9999,'yyyy') from dual;
TO_DATE(9999,'yyyy')
--------------------
--------------------
01-FEB-9999
If number exceeds 9999., user gets following error messages.
ORA-01812: year may only be specified once
*
ERROR at line 1:
ORA-01830: date format picture ends before converting entire input string
Tags: Convert year to date,convert year to Date using To_Date function,oracle convert year to date ,oracle convert year to date using to_date,oracle convert year to current year date.ERROR at line 1:
ORA-01830: date format picture ends before converting entire input string
No comments:
Post a Comment