问题:根据唯一字段编码修改其它字段,修改部分数据,数量在上万条数据,数据大,一开始就卡死了!笨办法,一条一条修改不知可年可月啊。其他方法个人原因实在是无能为力。如下:
update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-2v'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-2w'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-2x'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-2y'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-2z'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-31'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-32'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-33'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-34'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-35'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-36'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-37'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-38'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-39'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3a'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3b'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3c'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3d'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3e'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3f'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3g'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3h'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3i'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3j'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3k'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3l'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3m'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3n'; update ka02_new set aka065=1,aka166=1 where aka060='x-p02ca-a010-a001-3o'; ....
百度结果:百度了一下,很多解决方案,有的写的很粗糙,完全不理解,也许自己水平问题。有的是自己真的看不懂,个人水平跟不上。
解决方案:最后的解决办法,还是老办法,就是新建一张临时表(表b:a_2017 ),把所修改的唯一字段编码和修改后的数据放在b表。sql大体如下(原表a:ka02_new ,唯一字段aka060 ,修改的字段分别为aka065 和aka166 ):
update ka02_new b set b.aka065 = (select a.aka065 from a_2017 a where a.aka060 = b.aka060), b.aka166 = (select a.aka166 from a_2017 a where a.aka060 = b.aka060) where b.aka060 in (select a.aka060 from a_2017 a);
总结
以上所述是www.887551.com给大家介绍的解决oracle批量修改问题,希望对大家有所帮助