SQL Language (MOSC)

MOSC Banner

which row should have value 1 for its pseudo column connect_by_iscycle ?

edited Jul 18, 2017 5:00AM in SQL Language (MOSC) 2 commentsAnswered

---populate test table

create table family1(fatherid number,childid number);

insert into family1 values(null,1);

insert into family1 values(1,2);

insert into family1 values(1,3);

insert into family1 values(2,4);

insert into family1 values(4,1);

insert into family1 values(4,5);

commit;

select * from family1;

  FATHERID    CHILDID

---------- ----------

                    1

         1          2

         1          3

         2          4

         4          1

         4          5

-----Now combine "nocycle" with pseudocolumn connect_by_iscycle in some similar hierarchical queries but

Example 1:

select connect_by_iscycle,fatherid,childid,ltrim(sys_connect_by_path(childid,'->'),'->') from family1 start with fatherid is null connect by nocycle prior childid=fatherid;

CONNECT_BY_ISCYCLE           FATHERID    CHILDID             LTRIM(SYS_CONNECT_BY_PATH(CHIL

---------------------------- ---------- ------------------  --------------------

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center