Oracle之with as和update用法
时间:2018-11-29 13:13:21
收藏:0
阅读:1065
许久不用,又忘了,做个记录
update test b set b.code=(
with t as
(select t.id,code||‘_‘||row_number() over(partition by code order by id) code
from test t)
select a.code from t a where a.ID=b.ID
);
很多金融统计中,语句相当复杂。有可能会update的时候索引使用不上,看执行计划走不了hash join,数据量大的时候,适合于创建临时表。
原文:https://www.cnblogs.com/zhjh256/p/10037488.html
评论(0)