1. 程式人生 > >Mysql Update BIGINT UNSIGNED value is out of range

Mysql Update BIGINT UNSIGNED value is out of range

Mysql :

update oneTab set num = num - #{count,jdbcType=INTEGER}  where id = 1

 num是int型別,但如果num=0時,則會報出相應 BIGINT UNSIGNED value is out of range in (xx.num欄位)

解決方法:

update oneTab set num = CAST(num  AS SIGNED) - #{count,jdbcType=INTEGER}

提示:

(0 row(s) affected, 1 warning(s))