I hava two values picId
and tubId
and I want to update table A. But first of all, I must check if they are empty i.e ""
. I use an update statement twice. I'm wondering if I can use update statement only once to complete this task.
String picId = "";
String tubId = "1";
if(!"".equals(picId)) {
String update = "update A set columnName=someValue where id=" + picId;
//this method for update
this.executeUpdate(update, new Object[]{});
}
if(!"".equals(tubId)) {
String update = "update A set columnName=someValue where id=" + tubId;
this.executeUpdate(update, new Object[]{});
}
Thank you very much!