更新时间:2023-01-20 17:31:20
我认为以下内容适用于Oracle:
I think the following will work in Oracle:
update (select t.*, row_number() over (order by id) as newid) toupdate
set id = newid
以上答案很早以前就被接受.它不起作用.我认为答案应该包含有效的代码,所以:
The above answer was accepted a long time ago. It doesn't work. I think the answer should have code that does work, so:
merge into t dest using
(select t.*, row_number() over (order by id) as newid from t) src
on (dest.rowid = src.rowid)
when matched then update set id = newid;