This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi guys, I think the question in my previous post was not clear enough. Please go through the code snippet. con=ConnectionManager.getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE GIFI SET DESCRIPTION=?,TYPE=? WHERE ACCNO=?"); ps.setString(2, "CHEQUE"); ps.setString(3, "1000"); System.out.println(ps.execute()); For some updations,I have to skip the first parameter, because I will not have genuine value for this field. In that scenario, I don't want the existing value in the database field to be disturbed. I want to retain the value. How will I go about this by using prepared statements instead of building the queries dynamically using simple statements?. we are more inclined towards prepared statements b'cos we have a huge amounts of data inserted/updated. Thanks Manu
This is just as bad as cross-posting. See original thread The answers provided should suffice. Restated though, if you want to retain the original field value, then a set for it shouldn't be included in your statement.