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!

ORA-01847 - select fails when using internal subquery

Ram.Orcl-OracleMay 18 2010 — edited May 26 2010
Query 1:
------------
SELECT distinct to_date(to_char(EARLY_PICKUP_DATE)) as EARLY_PICKUP_DATE
from order_Release
where EARLY_PICKUP_DATE > sysdate -2

Works fine.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

However, when I execute the same quey, but using an internal subquery it fails...

Query2:
------------
select distinct sql1.EARLY_PICKUP_DATE
from
(sELECT to_date(to_char(EARLY_PICKUP_DATE)) as EARLY_PICKUP_DATE
from order_Release
) sql1
where sql1.EARLY_PICKUP_DATE > sysdate -2;

(sELECT to_date(to_char(EARLY_PICKUP_DATE)) as EARLY_PICKUP_DATE
*
ERROR at line 3:
ORA-01847: day of month must be between 1 and last day of month


Any workaround to make the second query work?

Edited by: ram_orcl on May 18, 2010 1:42 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 23 2010
Added on May 18 2010
4 comments
1,077 views