troubleshooting Question

Connect By Prior

Avatar of uz3a
uz3a asked on
Oracle Database
2 Comments1 Solution1076 ViewsLast Modified:
Hi,

I am trying to use connect by prior in hierarchical query. I am able to =
view all parents with their children in a certain format but I am also =
getting all the records one more time and couldn't figure why. The =
statement I am using is

 SELECT ID
 ,LPAD('-',2*(LEVEL-1)) ||OPT_DESC AS OPT_DESC
 , PARENT_ID,LEVEL
 FROM SCS_MENU_OPTION
 WHERE ISSHOWN =3D 1
    CONNECT BY PRIOR ID =3D PARENT_ID

If I used start with, I get only one sub child record and its sub =
children. The information in the table can be illustrated as below:

--parent 1
      -- child 1
      --child 2
            -- child 1
--parent 2
      -- child 1
            -- child 1
            -- child 2
      -- child 2
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros