Skip to content

Instantly share code, notes, and snippets.

@zelark
Last active August 29, 2015 14:13
Show Gist options
  • Save zelark/c853eb926942abe9ad77 to your computer and use it in GitHub Desktop.
Save zelark/c853eb926942abe9ad77 to your computer and use it in GitHub Desktop.
SQL> select * from nc_objects2;
OBJECT_ID PARENT_ID
---------- ----------
0
2 1
1
3 2
SQL> select
2 level,
3 obj.*
4 from nc_objects2 obj
5 start with object_id = 1
6 connect by rownum between 1 and 10
7 /
LEVEL OBJECT_ID PARENT_ID
---------- ---------- ----------
1 1
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
10 rows selected.
SQL> select
2 level,
3 obj.*
4 from nc_objects2 obj
5 start with object_id = 0
6 connect by rownum between 1 and 10
7 /
LEVEL OBJECT_ID PARENT_ID
---------- ---------- ----------
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
10 rows selected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment