Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error in updating a date

Status
Not open for further replies.

lydiattc

Programmer
Jun 3, 2003
52
US
Hi,

Hope this is an easy one for most of you. I got the following error. Can you help me fix it?

SQL> UPDATE EU_Setpoints SET Last_Update ='1-Aug-2003 5:05:31 PM'
2 WHERE Tag_ID=1;

UPDATE EU_Setpoints SET Last_Update ='1-Aug-2003 5:05:31 PM'
*
ERROR at line 1:
ORA-01830: date format picture ends before converting entire input string

Thanks,
Lydia
(ps, the astris should be under the first single quote)
 
Try
to_date('1-Aug-2003 5:05:31 PM','1-Aug-2003 5:05:31 PM') instead of just '1-Aug-2003 5:05:31 PM'

The default date format for Oracle is 'DD-MON-YY' and can be changed via the parameter NLS_DATE_FORMAT. If you want to use a different date format, you have to map the various date components for Oracle via the TO_DATE function.

 
Thanks for your reply. I tried to_date. Here's the error message:

SQL> UPDATE EU_Setpoints SET Last_Update =to_date('1-Aug-2003 5:05:31 PM','1-Aug-2003 5:05:31 PM')
2 WHERE Tag_ID=1;
UPDATE EU_Setpoints SET Last_Update =to_date('1-Aug-2003 5:05:31 PM','1-Aug-2003 5:05:31 PM')
*
ERROR at line 1:
ORA-01821: date format not recognized
 
Nuts! My mistake - I pasted the wrong string in!

UPDATE EU_Setpoints SET Last_Update =to_date('1-Aug-2003 5:05:31 PM','DD-Mon-YYYY HH:MI:SS PM');
 
Thanks. I had realized it might be a typo. It's working now. Thanks a lot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top