Oracle之with as和update用法

许久不用,又忘了,做个记录

update test b set b.val=(
with t as
(select t.id,val||'_'||row_number() over(partition by val order by id) t1
from test t)
select a.val from t a where a.ID=b.ID
);

很多金融统计中,语句相当复杂。有可能会update的时候索引使用不上,看执行计划走不了hash join,数据量大的时候,适合于创建临时表。

posted @ 2018-11-29 12:05  zhjh256  阅读(2579)  评论(2编辑  收藏  举报