1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
Connected as mni
SQL>
SQL> With data As (
2 Select '01' code, 'Direction' lib, Null as p_code from dual union all
3 Select '0101', 'Service RH', '01' from dual union all
4 Select '010101', 'Bureau 1', '0101' from dual union all
5 Select '010102', 'Bureau 2', '0101' from dual
6 )
7 Select code, lib, prior code code_service_parent, prior lib lob_service_parent
8 From data
9 connect by prior code = p_code
10 start with p_code is null
11 /
CODE LIB CODE_SERVICE_PARENT LOB_SERVICE_PARENT
------ ---------- ------------------- ------------------
01 Direction
0101 Service RH 01 Direction
010101 Bureau 1 0101 Service RH
010102 Bureau 2 0101 Service RH
SQL> |
Partager