Oracle文档中有这么一段解释:
The manner in which Oracle processes a WHERE clause (if any) in a hierarchical
query depends on whether the WHERE clause contains a join:
If the WHERE predicate contains a join, Oracle applies the join predicates before
doing the CONNECT BY processing.
Oracle applies any non-join predicates (that is, all predicates if the WHERE clause
does not contain a join) after doing the CONNECT BY processing without
affecting the other rows of the hierarchy.谁能给具体解释一下,最好附上实例。多谢!
The manner in which Oracle processes a WHERE clause (if any) in a hierarchical
query depends on whether the WHERE clause contains a join:
If the WHERE predicate contains a join, Oracle applies the join predicates before
doing the CONNECT BY processing.
Oracle applies any non-join predicates (that is, all predicates if the WHERE clause
does not contain a join) after doing the CONNECT BY processing without
affecting the other rows of the hierarchy.谁能给具体解释一下,最好附上实例。多谢!
解决方案 »
- DBLINK连接报错,密码问题?
- 在装有oracle服务器的机器上调试程序,还要安装oracle客户端吗
- Oracel临时表 表结构会在数据库重启后自动删除吗?
- 求sql语句
- 在linux下用proc/c++往oracle里写汉字的问题(汉字给拆了,不知如何解决)
- 请各位大神帮忙优化一下下面的一段SQL谢谢了
- Oracle 10g的SQL语句问题??
- oracle update 的问题
- 基础问题,请大家帮忙回答一下!
- 救命!!--oracle9i install on linux 7.2
- oracle 游标使用疑惑
- PROC中动态SQL能否使用EXEC SQL EXECUTE strSqlCmd INTO :v1,:v2 ;
SELECT LPAD(' ', 2 * (LEVEL - 1), '-') || ENAME P,
EMPNO,
MGR,
JOB,
SAL,
LEVEL
FROM scott.emp
WHERE sal>2000
START WITH MGR IS NULL
CONNECT BY PRIOR EMPNO = MGR;
等价于下面的sql:
SELECT LPAD(' ', 2 * (LEVEL - 1), '-') || ENAME P,
EMPNO,
MGR,
JOB,
SAL,
LEVEL
FROM (SELECT * FROM scott.emp WHERE sal>2000)
START WITH MGR IS NULL
CONNECT BY PRIOR EMPNO = MGR;---------------------------------------
SELECT LPAD(' ', 2 * (LEVEL - 1), '-') || ENAME P,
EMPNO,
MGR,
JOB,
SAL,
LEVEL
FROM scott.emp
WHERE empno>7800
START WITH MGR IS NULL
CONNECT BY PRIOR EMPNO = MGR;
等价于:
SELECT *
FROM (SELECT LPAD(' ', 2 * (LEVEL - 1), '-') || ENAME P,
EMPNO,
MGR,
JOB,
SAL,
LEVEL
FROM SCOTT.EMP
START WITH MGR IS NULL
CONNECT BY PRIOR EMPNO = MGR)
WHERE EMPNO > 7800;