oracle不支持update from的语法

xiaoxiangyu 2020-03-06

更新一个表中的数据,但条件需要和另外的表进行连接;sql server可以使用update from语法,可参考下面的链接:

https://www.cnblogs.com/cnmarkao/p/3687398.html

昨天因更新,数据库是oracle的,发现oracle不支持update from的语法

昨晚根据需要改写了下:

update tabA
set (col1,col2,col3,col4,col5)=(select b.col1,b.col2,substr(b.col3,4,2),substr(b.col3,7,2),substr(b.col3,10,2) from tabB b where tabA.col6=b.col6)
where tabA.col6 in (select b.col6 from tabB b where length(b.col3)=11)

正不正确不重要,重要的是知道oracle不支持update from的语法,其他可以搜索~~

相关推荐

lightlanguage / 0评论 2020-04-22