Oracle uses the Start with... Connect By clause to recursively query ORACLE. It provides an interesting function to connect by clause, which can sort the branches with a family tree structure. It applies to the structure of organizations or companies, financial account code, and so on. To use query traversal, you need to store data in the base table according to the hierarchy. For example, an organizational unit is a typical example. Implementation statement: SELECT column FROM table_name start with column = value connect by prior parent primary key = a friend on the Internet has provided a simple example. His example is as follows: -------------------------------------- Start... the Connect By clause recursive query is generally used for a table to maintain a tree structure. CREATE example TABLE: create table TBL_TEST (id number, NAME VARCHAR2 (100 BYTE), pid number default 0); INSERT test data: insert into TBL_TEST (ID, NAME, PID) VALUES ('1', '10', '0'); insert into TBL_TEST (ID, NAME, PID) VALUES ('2', '11', '1 '); insert into TBL_TEST (ID, NAME, PID) VALUES ('3', '20', '0'); insert into TBL_TEST (ID, NAME, PID) VALUES ('4', '12', '1'); insert into TBL_TEST (ID, NAME, PID) VALUES ('5', '123', '2 '); recursive select * from Root to tree end from TBL_TEST start with id = 1 connect by prior id = pid recursively select * from TBL_TEST start with id = 5 connect by prior pid = id author dhl004