MOD运算符在where子句中

时间:2013-10-07 04:53:38

标签: sql oracle

如果在MOD子句中使用WHERE获取无效数字异常,则希望根据ID更新偶数行或奇数行。

update employee  set respstr1 = 'EP' where mid = 7246 and (mod(id/2) = 1)

2 个答案:

答案 0 :(得分:8)

mod的正确语法是

mod(id,2)

答案 1 :(得分:1)

update employee  set respstr1 = 'EP' where mid = 7246 and (mod(id,2) = 1)

有关详细信息,请参阅以下链接 http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions088.htm

相关问题