Oracle subquery funniness

老子叫甜甜 提交于 2019-11-28 14:07:29

It is not a bug. As you did not qualify the column, Oracle interprets it as the current column value from table A -- which is within scope (cf. a correlative sub query). So the subquery just produces as many duplicates of that column value as there are rows in table B.

The in condition will either become true or false based on that. It will always be false when table B is empty. It will also be false in cases where Col_A is null. But in all other cases it will be true. So you'll get as many results as there are rows in table A that have a non-null value in Col_A, except when table B is empty, in which case you get no results.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!