wood burning stoves 2.0*
The moose likes JDBC 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
Bookmark "JDBC" Watch "JDBC" New topic
Author

JDBC

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30085
    
149

Lak,
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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, 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?
 
 
subject: JDBC
 
Similar Threads
Struts2 validation localization problem
URLyBird: Dates In Database File
Update Table Nested Query (Using Function)
Searching null date field
Lock/Unlock mechanism - another view