分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
SQL> set linesize 200SQL> set pagesize 200SQL> select * from a; ID AMT---------- ---------- 1 100 2 200 3 300 4 400SQL> select * from b; ID AMT---------- ---------- 1 99 2 199 3 299SQL> explain plan for update a set a.amt =(select b.amt from b where a.id=b.id) 2 ;Explained.SQL> select * from table(dbms_xplan.display());PLAN_TABLE_OUTPUT--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Plan hash value: 1561808831---------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |---------------------------------------------------------------------------| 0 | UPDATE STATEMENT | | 4 | 104 | 19 (22)| 00:00:01 || 1 | UPDATE | A | | | | || 2 | TABLE ACCESS FULL| A | 4 | 104 | 3 (0)| 00:00:01 ||* 3 | TABLE ACCESS FULL| B | 1 | 26 | 3 (0)| 00:00:01 |---------------------------------------------------------------------------Predicate Information (identified by operation id):--------------------------------------------------- 3 - filter("B"."ID"=:B1)Note----- - dynamic sampling used for this statement (level=2)19 rows selected.当A表ID=4的时候,那么B.ID=4 返回空,此时A表就被更新为空正确写法:update a set a.amt =(select b.amt from b where a.id=b.id)where a.id in (select b.id from b)
给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow
![这里写图片描述](https://i-blog.csdnimg.cn/blog_migrate/2e19ffb3303a490d20ea5d00dd397156.gif)