Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

hierarchy query and number of subnodes

Tom vd DuinAug 1 2010 — edited Aug 3 2010
Hi all,

I've been struggling with this: is there a possibility to select the number of subnodes of a banch? the only way I can think of is this:
select id, desc, (select count(*) from table b connect by prior id=parent_id start with b.parent_id =a.id )
from table a
connect by prior id=parent_id
start with parent_id is null
order siblings by id
but I wonder if this is the way to go or there's a more simple/faster way to do this.

Thanks in advance for any help! This query is executed on Oracle 10gr2 and up!
This post has been answered by Tubby on Aug 1 2010
Jump to Answer

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 31 2010
Added on Aug 1 2010
14 comments
16,734 views