File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC" Watch "JDBC" New topic


phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Is it possible to update any field without inserting value.
For date field I never call insert.
update employee set date = TO_DATE(?,'MM/DD/YYYY') where empid=?

I am getting only null values for that whenver I call update quesry .I would I update the date field.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33127

Welcome to JavaRanch!

"insert" adds a new row to a table. "update" changes the value of an existing row. So you are in fact changing the date column.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
This appears to be a PreparedStatement of some sort. How are binding the parameters to it? Are you having any errors. The mixture of date format functions and a PreparedStatement is a bit odd. You should be able to just call setDate(1, sqlDateValue) on the PreparedStatement and it will handle the formatting for you... aka you shouldn't need the date function in your SQL.

Perhaps you could post some of your Java code?
I agree. Here's the link:
subject: JDBC
It's not a secret anymore!