aspose file tools*
The moose likes JDBC and the fly likes Date Conversion in SQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Date Conversion in SQL" Watch "Date Conversion in SQL" New topic
Author

Date Conversion in SQL

Rao Raghu
Ranch Hand

Joined: Jan 05, 2007
Posts: 100
I need to enter both date and time in a table in Oracle in a column which is of type 'Date'. In the 'update table' query, I use the following for conversion:

to_date('dateString','yyyy-mm-dd hh24:mi:ss');

But I am getting this error:

ERROR at line 1:
ORA-01830: date format picture ends before converting entire input string

I have googled for this query and found that it is perfectly alright.

The dateString will be a date viz. '2007-06-14 09:31:24.762'.

Any body has any inputs on this?

Thanks in Advance.


RAGHU<br /> <br />"When the going gets tough, the tough get going"
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2476
    
    7

Oracle specs expect an uppercase mask:
'YYYY-MM-DD HH24:MI:SS'

and you have to drop the .762. It does not match your SS mask.

Regards, Jan
[ June 14, 2007: Message edited by: Jan Cumps ]

OCUP UML fundamental and ITIL foundation
youtube channel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date Conversion in SQL
 
Similar Threads
Date issues!
DATE Problem
connot resolve symbol-variable calculate
Has my compiler lost it?
Question about DateFormat class