在数据库表中存在多行数据完全一致时,需要修改其中一行执行sql方法
mysql:
update `test` set `id` = 2 limit 1;
oracle:
update "TEST" set "ID" = 2 where rownum = 1;
pgsql:
begin; -- 开启事务
declare cur_id cursor for select * from "test"; -- 定义游标
fetch cur_id; -- 开启游标,若未执行则下行语句会报错
update "test" set "id" = 2 where current of cur_id; -- 修改游标当行数据
close cur_id; -- 关闭游标
commit; -- 提交事务

1035

被折叠的 条评论
为什么被折叠?



