// With PreparedStatement, you leave ? where you come back later to fill in the data. // Update vendortimestamp field if the new value is bigger. // Demonstrates use of the GREATEST function. PreparedStatement stmt = conn.prepareStatement( "UPDATE vendors SET vendorTimestamp=GREATEST(vendorTimestamp, ?), WHERE vendorId=?" ); stmt.setLong( 1, aPossiblyBiggerTimestamp ); stmt.setInt( 2, desiredVendorId ); stmt.executeUpdate();