如果SELECT语句中有使用Alias,DISTINCT operator, CURSOR
expression, SET(union,union all,minus,intersect) operators, group_by_clause
, or aggregate(count,max,mix,avg) functions,则无法到查询返回值进行更新;
eg:
TABLE:emp
id name salary
==========================
10 aaaa 1234
13 abcd 2313
15 cdue 1245
... ... ...
case 1> 使用别名;
select id emp_id, name emp_name ,salary emp_salary
from emp
where id=10
for update; --这样是无法达到更新的目的;
可修改成
select id emp_id, name emp_name ,salary
from emp
where id=10
for update of salary --对salary字段进行更新;
阅读(1693) | 评论(0) | 转发(0) |