Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JDBC and Relational Databases 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Date Conversion in SQL" Watch "Date Conversion in SQL" New topic

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

Joined: Dec 20, 2006
Posts: 2551

Oracle specs expect an uppercase mask:

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
I agree. Here's the link:
subject: Date Conversion in SQL
It's not a secret anymore!