微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Oracle通过join sql-92组合选择星号连接

以下查询显示select *与connect by和left join结合不会返回所有列,而只返回在这些条件中使用的列.
这种行为对我很有用,因为select *不应该在发布中使用,它对请求数据很有用.
with t1 as (
  select 1 id,0 parent,'ROOT' name from dual
  union all
  select 2 id,1 parent,'CHILD-1' name from dual
  union all
  select 3 id,'CHILD-2' name from dual
),t2 as (
  select 1 t1id,'node' special from dual
)
  select * from t1
  left join t2 on t2.t1id=t1.id
  start with id = 2
  connect by prior parent = id;

而其他查询返回所有列

select * from t1
  start with id = 2
  connect by prior parent = id;

  select * from t1
  left join t2 on t2.t1id=t1.id;

我找不到关于这个功能的文档,有没有?

我相信您正在寻找的文档可以在这里找到: Hierarchical Queries

最相关的部分:

Oracle processes hierarchical queries as follows:

  • A join,if present,is evaluated first,whether the join is specified in the FROM clause or with WHERE clause predicates.

  • The CONNECT BY condition is evaluated.

  • Any remaining WHERE clause predicates are evaluated.

Oracle then uses the information from these evaluations to form the hierarchy using the following steps:

  1. Oracle selects the root row(s) of the hierarchy–those rows that satisfy the START WITH condition.

  2. Oracle selects the child rows of each root row. Each child row must satisfy the condition of the CONNECT BY condition with respect to one of the root rows.

  3. Oracle selects successive generations of child rows. Oracle first selects the children of the rows returned in step 2,and then the children of those children,and so on. Oracle always selects children by evaluating the CONNECT BY condition with respect to a current parent row.

  4. If the query contains a WHERE clause without a join,then Oracle eliminates all rows from the hierarchy that do not satisfy the condition of the WHERE clause. Oracle evaluates this condition for each row individually,rather than removing all the children of a row that does not satisfy the condition.

  5. Oracle returns the rows in the order shown in figure 9-1. In the diagram,children appear below their parents. For an explanation of hierarchical trees,see figure 3-1,“Hierarchical Tree”.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Java Oracle 结果集是Java语言中处理数据库查询结果的一种方式。通常情况下,Java程序会通过JDBC连接Oracle数据库并执行一条查询语句,返回一个ResultSet结果集。ResultSet是一个行集,包含了查询语句的返回结果。在
Java AES和Oracle AES是现代加密技术中最常使用的两种AES加密。在计算机通信领域,AES加密算法是一种十分重要的保密技术,被广泛应用于银行、保险、互联网电子支付等重要场合。
Java是一种广泛应用的编程语言,具备可靠性、安全性、跨平台性等优势,被广泛应用于企业级应用开发。而Oracle11g是一个强大的关系型数据库,由于其优秀的可靠性、安全性和扩展性,已经被广泛应用于企业级应用中。Jav
随着移动互联网的发展,抽奖活动成为了营销活动中不可或缺的组成部分。为了满足移动端用户的需求,我们可以使用jQuery开发移动端大转盘抽奖活动。
Java和Oracle都是在计算机领域应用非常广泛的技术,他们经常被用来搭建高效的软件系统。Java是一种面向对象的编程语言,而Oracle是一种关系型数据库管理系统。Java 和Oracle在应用中的联系非常紧密,它们能够通过相互
Java 是一门非常流行的编程语言,它可以运行于各种操作系统上,而 Oracle 是一个广泛使用的数据库软件。在 Java 对 Oracle 进行操作时,需要使用 Oracle 参数来确保程序正确工作。本文将从 Oracle 参数的定义、分类
随着电子竞技的兴起,越来越多的人开始慕名玩起了王者荣耀。而对于Python爱好者来说,这款游戏也有着很大的吸引力。因为Python可以帮助我们获取并处理游戏数据,从而获得更好的游戏体验。
Java与Oracle在数据处理方面都有着非常重要的地位,而在Java和Oracle的结合中,Integer类型则起到了不可替代的作用。Integer类型是Java中一个非常常用的数据类型,它可以表示范围在-2147483648到2147483647之间的整数
如今,JavaScript已经成为了web开发的必备技能之一,而IE浏览器也是众多开发者最常用的浏览器,那么,如何启用IE浏览器的JavaScript呢?
Java与Oracle是当今软件行业中广泛使用的两个技术。而SP(Stored Procedure)是Oracle数据库中存储过程的组件,可以在Java中调用Oracle数据库中的SP。在开发过程中,Java和Oracle的组合可以方便处理大规模的数据和建