Oracle?????????
????????? ???????[ 2010/5/27 13:17:20 ] ????????
????oracle?е?select????????START WITH...CONNECT BY PRIOR????????????connect by ??????????????????????????
select * from tablename start with cond1
connect by cond2
where cond3;
?????????????????????洢??????????????????д?????????Σ?
????id??parentid??????????????????parent??????????γ????????????????????????????????????????м????
????????COND1??????????????????????????????????????????????????????
????COND2??????????????????PRIOR????????????????? CONNECT BY PRIOR ID=PRAENTID?????????????ID??????????PRAENTID??????????????????????????
????COND3???????????????????????м?????й????
????????oracle???м???????????????
????DEPTID NUMBER ????id
????PAREDEPTID NUMBER ??????id(???????id)
????NAME CHAR (40 Byte) ????????
???????????????????.
select * from persons.dept start with deptid=76 connect by prior paredeptid=deptid
???????????????????.
select * from persons.dept start with paredeptid=0 connect by prior deptid=paredeptid
?????????level ?????????????.
select a.*??level from persons.dept a start with paredeptid=0 connect by prior deptid=paredeptid
????PS??start with ??????????????????????????????????
????connect by prior??????????????н??????
??????prior???????????????????????????У????????е??????
????????
select * from table
start with org_id = ??HBHqfWGWPy??
connect by prior org_id = parent_id;
?????????????????????洢??????????????????д?????????Σ?
????org_id??parent_id??????????????????parent??????????γ???????????
?????????????????????????????????м????
???????У?
????????1 ??????????????????????????????????????????????????????
????????2 ??????????????????PRIOR?????????????
???????? CONNECT BY PRIOR org_id = parent_id?????????????org_id ??????????parent_id??????????????????????????
????????3 ???????????????????????м?????й????
?????????????£?
??????????????????????????????????????????????????????Σ?????????????£?
????????????????????
???????????????y??
?????????????ж?y??????δ??????????????У????????????δ???????????????е????????????е??????
?????????????y???????????????????????е??崠??
???????崠????????y???????????е??????衣
?????????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11