Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC

 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 34835
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maximilian Xavier Stocker
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic