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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

KING 7839<br />

JONES 7566 7839<br />

SCOTT 7788 7566<br />

ADAMS 7876 7788<br />

FORD 7902 7566<br />

SMITH 7369 7902<br />

BLAKE 7698 7839<br />

ALLEN 7499 7698<br />

WARD 7521 7698<br />

MARTIN 7654 7698<br />

TURNER 7844 7698<br />

JAMES 7900 7698<br />

CLARK 7782 7839<br />

MILLER 7934 7782<br />

14 rows selected.<br />

So, KING is <strong>the</strong> start with set <strong>the</strong>n JONES BLAKE and CLARK fall under him. Each of <strong>the</strong>m<br />

becomes <strong>the</strong> PRIOR record in turn and <strong>the</strong>ir trees are expanded.<br />

Reviews<br />

April 12, 2001 - 8am Central time zone Bookmark | Bottom | Top<br />

Reviewer: gaurang<br />

useful summary of <strong>connect</strong> <strong>by</strong> September 25, 2002 - 2pm Central time zone Bookmark | Bottom | Top<br />

Reviewer: RParr from Seattle, WA U.S.A.<br />

in a fraction of <strong>the</strong> space you provided a much better overview of <strong>connect</strong> <strong>by</strong> and basic heirarchical<br />

query.<br />

Nice overview January 22, 2003 - 1am Central time zone Bookmark | Bottom | Top<br />

Reviewer: Anirudh from New delhi, India<br />

Hi Tom<br />

Your explaination about <strong>the</strong> <strong>connect</strong> <strong>by</strong> clause was very helpfull. However, I have a <strong>question</strong><br />

we have got a function<br />

FUNCTION Get_Parent_Entity_Id<br />

(<br />

in_test_pgm_id number,<br />

in_test_admin_id number,<br />

ic_child_entity_type_code varchar2,<br />

in_child_entity_id number,<br />

ic_parent_entity_type_code varchar2<br />

)<br />

RETURN number IS<br />

ln_count NUMBER;<br />

BEGIN<br />

ln_count := 0;<br />

BEGIN<br />

select n_parent_entity_id<br />

into ln_count<br />

from<br />

(<br />

select<br />

n_test_pgm_id,<br />

n_test_admin_id,<br />

c_parent_entity_type_code,<br />

n_parent_entity_id<br />

from<br />

rpt_entity_struc res<br />

start with<br />

res.n_test_pgm_id = in_test_pgm_id and<br />

res.n_test_admin_id = in_test_admin_id and<br />

res.n_entity_struc_id = 0 and<br />

res.c_child_entity_type_code = ic_child_entity_type_code and<br />

res.n_child_entity_id = in_child_entity_id<br />

<strong>connect</strong> <strong>by</strong><br />

res.n_test_pgm_id = prior n_test_pgm_id and<br />

res.n_test_admin_id = prior n_test_admin_id and<br />

res.n_entity_struc_id = prior n_entity_struc_id and

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

Saved successfully!

Ooh no, something went wrong!