Oracle tree query start with connect

Source: Internet
Author: User

Oracle tree query start with connect

I. Introduction
In Oracle, start with connect by (prior) is used to query data in a tree structure. Here, start with conditon gives the range of data searches, and connect by gives the conditions for Recursive queries. The prior keyword indicates the parent data, and the prior condition indicates the conditions for the child data to meet the parent data. As follows:
Start with id = '000000' connect by prior parent_id = id and prior num = 5
Indicates that the query id is 10001, And the recursive query parent_id = id is 5 Records.
Ii. Instances
1. Construct Data

1 -- table structure 2

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.