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!

to_date and quarter format

InoLJun 3 2010 — edited Jun 3 2010
To_date and to_char formats usually work both ways. But not for quarter (Q):
select to_char(sysdate,'q') from dual;

select to_date('2','q') from dual;

T
-
2


1 row selected.

select to_date('2','q') from dual
                   *
Error at line 1
ORA-01820: format code cannot appear in date input format
Any reason why to_date won't accept Q as format? I would expect it to return the first day of the quarter of the current year, just like using MM returns the first day of the month of the current year:
select to_date('2','mm') from dual;

TO_DATE('
---------
01-FEB-10
I tried it on 9.2.0.8 and 10.2.0.1 (XE).
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 1 2010
Added on Jun 3 2010
10 comments
8,971 views