Home » SQL & PL/SQL » SQL & PL/SQL » how to retrieve attributes in the starts with of the connect by
how to retrieve attributes in the starts with of the connect by [message #196820] Sat, 07 October 2006 22:54 Go to next message
khanna111
Messages: 5
Registered: October 2006
Junior Member
Hi,

I have the following SQL to retrieve the parents of the groups with the ids (1300, 1200, 1000) specified below. Is there a way to inlude these ids in the output of the outer select statement? What is required is that the final output of the outer select contains "1300, 1200, 1000" as well.
The query is:

select GG.group_id from CSS_GROUP_GRAPH GG
connect by GG.member_group_id = prior GG.group_id
start with GG.member_group_id IN
(
1300, 1200, 1000
);

Thanks
Re: how to retrieve attributes in the starts with of the connect by [message #196849 is a reply to message #196820] Sun, 08 October 2006 09:30 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Would UNION help?
SELECT     gg.GROUP_ID
      FROM css_group_graph gg
CONNECT BY gg.member_group_id = PRIOR gg.GROUP_ID
START WITH gg.member_group_id IN (1300, 1200, 1000)
UNION
SELECT 1300 FROM DUAL
UNION
SELECT 1200 FROM DUAL
UNION
SELECT 1000 FROM DUAL;
Re: how to retrieve attributes in the starts with of the connect by [message #196856 is a reply to message #196820] Sun, 08 October 2006 12:36 Go to previous message
khanna111
Messages: 5
Registered: October 2006
Junior Member
Hi,

Thanks for the information.

Previous Topic: ref cursors
Next Topic: Which is the best cursor loop for ETL with large no of columns
Goto Forum:
  


Current Time: Fri Dec 09 09:58:16 CST 2016

Total time taken to generate the page: 0.12796 seconds