复制代码 代码如下:
pid id
a b
a c
a e
b b1
b b2
c c1
e e1
e e3
d d1
指定pid=a,选出
a b
a c
a e
b b1
b b2
c c1
e e1
e e3
SQL语句:select parent,child from test start with pid='a'
connect by prior id=pid
复制代码 代码如下:
SQL> desc comm_org_subjection
NameNull? Type
----------------------------------------- -------- ----------------------
ORG_SUBJECTION_IDNOT NULL VARCHAR2(32) 子键
ORG_IDNOT NULL VARCHAR2(32)
FATHER_ORG_IDNOT NULL VARCHAR2(32) 父键
LOCKED_IFNOT NULL VARCHAR2(1)
START_DATENOT NULL DATE
END_DATEDATE
EDITION_NAMEPLATENUMBER(8)
CODE_AFFORD_IFVARCHAR2(1)
CODE_AFFORD_ORG_IDNOT NULL VARCHAR2(32)
CODING_SHOW_IDNUMBER(8)
BSFLAGVARCHAR2(1)
MODIFI_DATEDATE
CREATOR_IDVARCHAR2(32)
CREATE_DATEDATE
CREATORVARCHAR2(35)
复制代码 代码如下:
select * from comm_org_subjection a
start with a.org_id='C6000000000001'
connect by prior a.org_subjection_id=a.father_org_id
复制代码 代码如下:
select org_id from comm_org_subjection a
start with a.org_id='C6000000000001'
connect by prior a.father_org_id=a.org_subjection_id
新闻热点
疑难解答