假设下面的这段SQL存在单行子查询返回多个行的错误
select a.*,(selcet b.id from b where b.name = a.name ) from a
现象1:
select a.*,(selcet b.id from b where b.name = a.name ) from a
--在plsql界面不报错,但是展开所有的字段就会报错:ora-01427:单行子查询返回多个行
现象2:
select a.*,(selcet b.id from b where b.name = a.name ) from a order by a.name
--在这段后面加上排序语句,sql执行就会立即报错
对于以上两种情况的思考:
1.现象1plsql只获取了有限的rownum行,恰巧这些行中没有错误的数据,所有没有报错;
2.现象2plsql进行排序处理,会搜索所有的复合条件的数据导致立即报错;