create table T1 (I int, PARENT_I int, RELATE varchar2(100))
Table created.
create table T2 (RELATE_STRING varchar2(1000))
Table created.
insert into T1 values (1, null, 'root')
1 row(s) inserted.
insert into T1 values (2, 1, 'child')
1 row(s) inserted.
insert into T1 values (3, 1, 'child')
1 row(s) inserted.
insert into T1 values (4, 2, 'grandchild')
1 row(s) inserted.
insert into T1 values (5, 2, 'grandchild')
1 row(s) inserted.
insert into T1 values (6, 3, 'grandchild')
1 row(s) inserted.
insert into T1 values (7, 3, 'grandchild')
1 row(s) inserted.
insert into T1 values (8, 7, 'great grandchild')
1 row(s) inserted.
commit
Statement processed.
insert into T2@don (RELATE_STRING)
select sys_connect_by_path(RELATE, '-') as RELATE
from T1@don
start with PARENT_I is null
connect by prior I = PARENT_I
ORA-02019: connection description for remote database not foundMore Details: https://docs.oracle.com/error-help/db/ora-02019
select * from T2@don
ORA-02019: connection description for remote database not foundMore Details: https://docs.oracle.com/error-help/db/ora-02019
rollback
Statement processed.
insert into T2@don (RELATE_STRING)
with cte (LVL, I, PARENT_I, RELATE) as (
select 1 as LVL,
I,
PARENT_I,
'+' || RELATE as RELATE
from T1@don
where PARENT_I is null
union all
select c.LVL + 1,
t.I,
t.PARENT_I,
c.RELATE || '+' || t.RELATE
from cte c
join T1 t
on t.PARENT_I = c.I)
select RELATE from cte order by LVL, I
ORA-02019: connection description for remote database not foundMore Details: https://docs.oracle.com/error-help/db/ora-02019
select * from T2@don
ORA-02019: connection description for remote database not foundMore Details: https://docs.oracle.com/error-help/db/ora-02019
rollback
Statement processed.
insert into T2 (RELATE_STRING)
with cte (LVL, I, PARENT_I, RELATE) as (
select 1 as LVL,
I,
PARENT_I,
'=' || RELATE as RELATE
from T1@don
where PARENT_I is null
union all
select c.LVL + 1,
t.I,
t.PARENT_I,
c.RELATE || '=' || t.RELATE
from cte c
join T1 t
on t.PARENT_I = c.I)
select RELATE from cte order by LVL, I
ORA-02019: connection description for remote database not foundMore Details: https://docs.oracle.com/error-help/db/ora-02019
select * from T2@don
ORA-02019: connection description for remote database not foundMore Details: https://docs.oracle.com/error-help/db/ora-02019
rollback
Statement processed.