Home » SQL & PL/SQL » SQL & PL/SQL » To_Date() (Oracle 10g)
To_Date() [message #569290] Wed, 24 October 2012 08:00 Go to next message
mjaved39
Messages: 1
Registered: October 2012
Location: Lahore Pakistan
Junior Member

Dear Fellows,
i want to save 10/24/2012 to vdatefrom variable i have below line in my Script


vdatefrom := TO_DATE ('01-MON-2012 00:00:00', 'DD-MON-RRRR HH24:MI:SS');

Please help me.
Re: To_Date() [message #569293 is a reply to message #569290] Wed, 24 October 2012 08:08 Go to previous messageGo to next message
muralikri
Messages: 638
Registered: August 2011
Location: chennai
Senior Member

it's raising the error "ORA-01843: not a valid month"
select TO_DATE ('01-MON-2012 00:00:00', 'DD-MON-RRRR HH24:MI:SS') from dual 

Re: To_Date() [message #569295 is a reply to message #569293] Wed, 24 October 2012 08:15 Go to previous messageGo to next message
Roachcoach
Messages: 1194
Registered: May 2010
Location: UK
Senior Member
Make the format mask match the input 'format'.
Re: To_Date() [message #569297 is a reply to message #569290] Wed, 24 October 2012 08:26 Go to previous messageGo to next message
Michel Cadot
Messages: 58847
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
i want to save 10/24/2012 to vdatefrom variable i have below line in my Script


SQL> declare
  2    vdatefrom date;
  3  begin
  4    vdatefrom := to_date('10/24/2012','MM/DD/YYYY');
  5  end;
  6  /

PL/SQL procedure successfully completed.

All date format elements are described in: Datetime Format Models

Regards
Michel
Re: To_Date() [message #569305 is a reply to message #569297] Wed, 24 October 2012 10:05 Go to previous message
c_stenersen
Messages: 254
Registered: August 2007
Senior Member
Quote:
'01-MON-2012 00:00:00'

Which month is "MON"?
Previous Topic: Syntax error
Next Topic: NVL Function
Goto Forum:
  


Current Time: Wed Aug 20 15:33:42 CDT 2014

Total time taken to generate the page: 0.10651 seconds