Oracle tree SQL query

Source: Internet
Author: User

Select typecode, lpad ('', 4 * level-1) | typename
From ajtype
Start with p_code is null connect by prior typecode = p_code;

Result:

1 + City appearance and sanitation
15 + Lighting management
151 + Installation rejected
15101 + Refuse to install night scene lighting facilities
152 + Illegal installation
15201 + Do not install night scene lighting facilities at specified locations
15202 + Do not install night scene lighting facilities as required
15203 + Do not install night scene lighting facilities as required
15204 + Night scene lighting facilities are not installed in the specified light source color
153 + Don't light on time

 

 

Select sys_connect_by_path (typename, '>') typename
From ajtype
Start with p_code is null connect by prior typecode = p_code;

1 > City appearance and sanitation
15 > City appearance and sanitation> lighting management
151 > City appearance and sanitation> lighting management> Installation rejected
15101 > City appearance and sanitation> lighting management> Installation rejected> Installation of night scene lighting facilities rejected
152 > City appearance and sanitation> lighting management> illegal installation
15201 > City appearance and sanitation> lighting management> illegal installation> night scene lighting facilities are not installed according to the specified location
15202 > City appearance and sanitation> lighting management> illegal installation> night scene lighting facilities are not installed as required

 

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.