Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 Co

Source: Internet
Author: User


Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 Conntect by problem SQL: 1. The most common method of connect by is www.2cto.com select SYS_CONNECT_BY_PATH (sal, ',') from (select sal, ROW_NUMBER () over (partition by deptno order by sal) rn, ROW_NUMBER () over (partition by deptno order by sal)-1 as dn from scott. emp where deptno = '20') start with rn = 1 connect by prior rn = dn display result:, random, 1200, 1650,1200, 1650,446 2.5, 12 4462.5, 1650,446, 4500,1200, 2.5, 4500,4500 no problem 2: select SYS_CONNECT_BY_PATH (sal, ',') from (select sal, ROW_NUMBER () over (order by sal) rn, ROW_NUMBER () over (order by sal)-1 as dn from scott. emp where deptno = '20') start with rn = 1 connect by prior rn = dn: the result is the same as the preceding one. Statement 3: with ss as (select sal, ROW_NUMBER () over (partition by deptno order by sal) rn, ROW_NUMBER () over (partition by dept No order by sal)-1 as dn from scott. emp where deptno = '20') select SYS_CONNECT_BY_PATH (sal, ',') from ss start with rn = 1 connect by prior rn = dn result: Same as above: with ss as (select sal, ROW_NUMBER () over (order by sal) rn, ROW_NUMBER () over (order by sal)-1 as dn from scott. emp where deptno = '20') select SYS_CONNECT_BY_PATH (sal, ',') from ss start with rn = 1 connect by prior rn = dn result:, random, 12 The results showed that only 2 recursion was performed.

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.