13.05.2013 Views

Thanks for the question regarding "connect by ", versi

Thanks for the question regarding "connect by ", versi

Thanks for the question regarding "connect by ", versi

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

From Jet-Lagged Jim February 11, 2005 - 1pm Central time zone Bookmark | Bottom | Top<br />

Reviewer: Jim from Vancouver<br />

Regading my above inquiry - please disregard, I figured it out. T'was a muddled-brain posting at<br />

1:00am from a handful of timezones. Feel free to remove. <strong>Thanks</strong> again.<br />

Followup February 12, 2005 - 8am Central time zone:<br />

don't sweat it, i just got back last night 6 hours off myself :)<br />

2 Tables in using start with , <strong>connect</strong> <strong>by</strong> May 9, 2005 - 3pm Central time zone<br />

Bookmark | Bottom | Top<br />

Reviewer: Lamya from Houston,TX<br />

I have 2 tables<br />

CREATE TABLE HYBRIDOMA<br />

(<br />

HYBRIDOMA_ID NUMBER(10),<br />

HYBRIDOMA_NAME VARCHAR2(20 BYTE),<br />

)<br />

CREATE TABLE CLONE<br />

(<br />

CLONE_ID NUMBER(10),<br />

CLONE_NAME VARCHAR2(60 BYTE),<br />

PARENT_TYPE VARCHAR2(10 BYTE),<br />

PARENT_ID NUMBER(22)<br />

)<br />

INSERT INTO CLONE ( CLONE_ID, CLONE_NAME, PARENT_TYPE, PARENT_ID ) VALUES (<br />

1, 'clone_from_h1', 'HYBRID', 1);<br />

INSERT INTO CLONE ( CLONE_ID, CLONE_NAME, PARENT_TYPE, PARENT_ID ) VALUES (<br />

2, 'clone_from_clone1', 'CLONE', 1);<br />

INSERT INTO CLONE ( CLONE_ID, CLONE_NAME, PARENT_TYPE, PARENT_ID ) VALUES (<br />

3, 'clone_from_h1', 'HYBRID', 1);<br />

commit;<br />

INSERT INTO HYBRIDOMA ( HYBRIDOMA_ID, HYBRIDOMA_NAME ) VALUES (<br />

0, 'fff');<br />

INSERT INTO HYBRIDOMA ( HYBRIDOMA_ID, HYBRIDOMA_NAME ) VALUES (<br />

1, 'rrrrr');<br />

INSERT INTO HYBRIDOMA ( HYBRIDOMA_ID, HYBRIDOMA_NAME ) VALUES (<br />

2, 'ddddddd');<br />

commit;<br />

Now <strong>the</strong> clone table has parent type = clone or hybrid. thus <strong>the</strong> clone can have parents in <strong>the</strong><br />

hybridoma table.<br />

I would like to create a select statement which would start on <strong>the</strong> top and select all children ,<br />

from both hybridoma and clone .<br />

I tried this but its not helping me .<br />

select level , lpad('*',level*2,'*') || decode( parent_type ,'CLONE' , clone_name , 'HYBRID' ,<br />

hybridoma_name)<br />

from clone c , hybridoma h<br />

where c.parent_id = h.HYBRIDOMA_ID<br />

start with c.parent_id = 1<br />

<strong>connect</strong> <strong>by</strong> prior c.clone_id = c.parent_id and clone_ID parent_id<br />

zone<br />

Very In<strong>for</strong>mative - but can you get only a portion of <strong>the</strong> hierarchy? January 30, 2006 - 7pm Central time<br />

Reviewer: Marshall B Thompson from Charlotte, NC, USA<br />

Bookmark | Bottom | Top

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!