Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Location
    down on the cube farm, left then right then another left
    Posts
    467

    Unanswered: "connect by" question

    Is there any way when using a "connect by" construct to say "only give me the terminal leaf nodes?
    NOTE: Please disregard the label "Senior Member".

  2. #2
    Join Date
    Jan 2004
    Posts
    370
    Note:29704.1 on MetaLink has examples of tree walking, including finding leaf nodes.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    This may be a totally daft answer due to lack of sleep, by why do you need CONNECT BY?
    I always view the CONNECT BY as having a PARENT_ID & CHILD_ID in each record.
    I think all the leaf nodes are records where CHILD_ID IS NULL.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  4. #4
    Join Date
    Nov 2003
    Location
    down on the cube farm, left then right then another left
    Posts
    467
    Thanks for your responses. Sorry so late getting back to you. I was running of to vacation when I submitted question.

    SkyWriter - I do not have access to MetaLink. :-(

    Anna - I think your definition of a terminal leaf node is correct. My requirements are to find leaf nodes that have parents and are terminal. If no parent they should not be in my list.

    Anyway, the way I ultimately solved was with:
    Code:
    select b.id
    from (      
          select id, prntid
          from idtable
          START WITH id = targetid
          CONNECT BY PRIOR id = prntid) a,
         (select id, prntid
          from idtable
          START WITH id = targetid
          CONNECT BY PRIOR id = prntid) b
    where b.id = a.id (+)
    and a.prntid IS NULL
    NOTE: Please disregard the label "Senior Member".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •