troubleshooting Question

connect by prior child ,parent Object

Avatar of chalie001
chalie001 asked on
Oracle Database
7 Comments1 Solution181 ViewsLast Modified:
select obj_name,obj_child,obj_parent,
      sys_connect_by_path(obj_name,'/')path,
      connect_by_root obj_name
      from cal_obj
      start with obj_parent is null
      connect by prior obj_child = obj_parent;

OBJ_NAME	OBJ_CHILD	OBJ_PARENT	PATH	      CONNECT_BY_ROOTOBJ_NAME
MainObject			  	          /MainObject    MainObject



all object in table
select * from cal_obj;

OBJ_CHILD	OBJ_NAME	OBJ_TYPE	OBJ_TITLE	DESCRIPTION	OBJ_PARENT
1193	 	SecondObject	Form						1192
1194		ThirdObject	Form						1193
		MainObject	Form			


i what a query to return 


OBJ_CHILD	OBJ_NAME	OBJ_TYPE	OBJ_TITLE	DESCRIPTION	OBJ_PARENT
SecondObject	MainObject	Form						
ThirdObject	SecondObject	Form					MainObject
		ThirdObject	Form			                                SecondObject


create table CAL_OBJ
(
  obj_child   NUMBER(4),
  obj_name    VARCHAR2(100),
  obj_type    VARCHAR2(50),
  obj_title   VARCHAR2(50),
  description VARCHAR2(50),
  obj_parent  NUMBER(5)
);

 insert into cal_obj(obj_parent,                       
                        obj_name,
                        obj_type)
                    values(1192,                          
                           'MainObject',
                           'Form');
                           
                           
                           
                           insert into cal_obj(obj_parent,
                                               obj_child,                       
                        obj_name,
                        obj_type)
                    values(1192, 
                            1193,                         
                           'SecondObject',
                           'Form');
                           
                               insert into cal_obj(obj_parent,
                                               obj_child,                       
                        obj_name,
                        obj_type)
                    values(1193, 
                            1194,                         
                           'ThirdObject',
                           'Form');
am in oracle database 11gR2
ASKER CERTIFIED SOLUTION
flow01
IT-specialist

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
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 7 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