Oracle recursive query and Oracle recursive query

Source: Internet
Author: User

Oracle recursive query and Oracle recursive query

1 select. accountcodeid,. accountcode,. accountcodename, 2 SYS_CONNECT_BY_PATH (. accountcodename, '\') as fullname,. parentcodeid, level 3 from fm_accountcode a 4 where. accountcodeid> = 10000 5 start with. parentcodeid is null 6 connect by prior. accountcodeid =. parentcodeid; 7 8 select. accountcodeid,. accountcode,. accountcodename, 9 SYS_CONNECT_BY_PATH (. accountcodename, '\') as fullname, 10. parentcodeid11 from fm_accountcode a12 where. accountcodeid> 1000013 and connect_by_isleaf = 114 start with. parentcodeid is null15 connect by prior. accountcodeid =. parentcodeid;

Recursive queries in oracle are very useful for tree structure data.

Differences between the two: above, all data, including the structure; below, all the last nodes, including the structure, see Oracle Document 11g for details.

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.