Oracle recursive query Example Analysis

Source: Internet
Author: User

Oracle recursive query example analysis start with connect by Hierarchical Queries. areaid,. name,. parentid,. levelcodeFrom prnbsn_area a www.2cto.com Start With. areaid = 3 Connect By Prior. areaid =. parentid this query will find all sub-regions in Chongqing from the bottom up query Select. areaid,. name,. parentid,. levelcodeFrom prnbsn_area aStart With. areaid = 78 Connect By Prior. parentid =. areaid query all the superiors of Sanya (78) www.2cto.com start: The condition of the root record (starting from that record) connect by: Specifies the relationship between the row of the parent record and the row of the Child record. In hierarchical query, the condition expression must use the prior operator to specify the row of the parent record, for example, connect by prior pid = id or connect by pid = PRIOR id. If the connect by condition is a combination condition, only one condition requires the prior operator, for example, connect by last_name! = 'King' and prior employee_id = manager_id however, connect by cannot contain subqueries. Prior is a binary operator.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.