for an prepared statement
update table t set a = ? ,b = ? where i = ?
column a to stay column a ie. a=a and only need to setInt for b and visa versa, without needing another statement. Is there a concise way of doing this?
for an prepared statement
update table t set a = ? ,b = ? where i = ?
column a to stay column a ie. a=a and only need to setInt for b and visa versa, without needing another statement. Is there a concise way of doing this?
You could try this:
UPDATE TableT
SET a = COALESCE(?, a),
b = COALESCE(?, b)
WHERE i = ?
To leave a value unchanged, simply pass NULL in. Of course you cannot use this method if you actually wish to set the value to NULL.