Sys_connect_by_path function usage

Source: Internet
Author: User


Sys_connect_by_path function usage the sys_connect_by_path function is used to return the value of the hierarchy until the current row. Example: www.2cto.com SQL code select * from (select ltrim (sys_connect_by_path (id, ','), ',') id, ltrim (sys_connect_by_path (name ,','),', ') name, level as lvl, lpad ('', 2 * (level-1) | id, lpad ('', 2*(level-1 )) | name, lead (level) over (order by id) leadlvlorder, case when (level-lead (level) over (order by id )) <0 then 0 else 1 end isleaf from table_name c start with id = 0 connect by prior c. id = c. parent_id) where isleaf = 1;
 

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.