Home » SQL & PL/SQL » SQL & PL/SQL » ORA-01839
ORA-01839 [message #640] Mon, 25 February 2002 09:44 Go to next message
VĂ­ctor
Messages: 17
Registered: October 2001
Junior Member
I have this query:

select distinct emplid,BIRTHDATE,
TO_DATE((TO_CHAR(SYSDATE,'YYYY')||TO_CHAR(BIRTHDATE,'MMDD')),'YYYYMMDD')
FROM PS_PERSONAL_DATA C
WHERE BIRTHDATE IS NOT NULL
and TO_DATE((TO_CHAR(SYSDATE,'YYYY')||TO_CHAR(BIRTHDATE,'MMDD')),'YYYYMMDD') BETWEEN SYSDATE-30 and (SYSDATE)

birthdate is of date type.
I get the message error ORA-01839 date not valid for month specified. I can avoid this by removing the DISTINCT clause but i need it. please help, thanks
Re: ORA-01839 [message #655 is a reply to message #640] Tue, 26 February 2002 01:57 Go to previous message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
the problem is not in distinct . i tried your query here and it is fine.

problem is with your data.

-----------------------

ORA-01839 date not valid for month specified

Cause:

The day of the month specified in the date is invalid for the given month. The day of the month (DD) must be between 1 and the number of days in the month.

Action:

Enter a valid day of the month for the specified month.
Previous Topic: sql output format
Next Topic: Error i cannot make sense of
Goto Forum:
  


Current Time: Mon Apr 15 23:56:25 CDT 2024