Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: connect by ora-01436
PJP, logically how can the first row in a hierarchy have values in the
prior columns? You have three rows in your test data that refer back
to themselves: 1,1,1,1 and 5,5,5,5 and 6,6,6,6.
UT1 > insert into t values (1, 1, NULL, NULL);
1 row created.
UT1 > insert into t values (2, 2, 1, 1);
1 row created.
UT1 > insert into t values (3, 3, 1, 1);
1 row created.
UT1 > insert into t values (4, 4, 2, 2);
1 row created.
UT1 > insert into t values (5, 5, NULL, NULL);
1 row created.
UT1 > insert into t values (6, 6, NULL, NULL);
UT1 > insert into t values (7, 7, 6, 6);
1 row created.
UT1 > commit;
Commit complete.
UT1 >
UT1 > select *
2 from t
3 start with (c is null and d is null)
4 connect by prior c = a and prior d = b
5 /
A B C D
---------- ---------- ---------- ----------
1 1 5 5 6 6
UT1 > select *
2 from t
3 start with (c is null and d is null)
4 connect by c = prior a and d = prior b
5 /
A B C D
---------- ---------- ---------- ----------
1 1 2 2 1 1 4 4 2 2 3 3 1 1 5 5 6 6 7 7 6 6
7 rows selected.
HTH -- Mark D Powell -- Received on Fri Feb 17 2006 - 09:27:43 CST