使用ibatis xml提到我的原始查询: 数据库记录未更新。
<update>
update
nest set
nstatus = #status#
where
nestid =
#nestId# and (nstatus != #deviceStatus# OR nstatus IS NULL)
</update>
但java SQL准备以下查询我的日志如下。
DEBUG java.sql.Connection - {conn-100103} Preparing Statement: update nest set nstatus = ? where nestid = ? and nstatus != ? or nstatus = NULL
DEBUG java.sql.PreparedStatement - {pstm-100104} Executing Statement: update nest set nstatus = ? where nestid = ? and nstatus != ? or nstatus = NULL
DEBUG java.sql.PreparedStatement - {pstm-100104} Parameters: [Apple, 150495, Device]
DEBUG java.sql.PreparedStatement - {pstm-100104} Types: [java.lang.String, java.lang.Integer, java.lang.String]
我正在使用mysql Db来更新它接受以下更新查询的记录。 (= null) is not accepting in mysql while updating records
和 (IS NULL) is acceptable to update records
声明应该是这样的:
update nest set nstatus = ? where nestid = ? and nstatus != ? or nstatus IS NULL
请告诉我溶解,我应该在ibatis更新声明中做些什么改变。
答案 0 :(得分:0)
您需要将更新命令重新分配为
update nest set
nstatus = #status#
where
( nestid = #nestId# AND nstatus != #deviceStatus#)
OR
nstatus IS NULL