日期:2014-05-16 浏览次数:20473 次
create table SECURITY_RES_CATEGORY ( ID NUMBER(6) not null, NAME VARCHAR2(100), DESCRIPTION VARCHAR2(200), PARENT_ID NUMBER(6), APP_ID NUMBER(3), STATUS NUMBER(1) default 1 )
select * from security_res_category where parent_id=0
select * from security_res_category where parent_id=361
select * from security_res_category where app_id=181 START WITH ID=361 CONNECT BY parent_id = PRIOR ID;
SELECT b.* FROM security_res_category a JOIN security_res_category b ON a.parent_id = b.ID WHERE a.ID = 261;
SELECT * FROM security_res_category START WITH ID = 363 CONNECT BY PRIOR parent_id = ID;
select * from security_res_category where parent_id= (select parent_id from security_res_category where id=363)
SELECT SYS_CONNECT_BY_PATH (mc, '/') FROM security_res_category WHERE ID = 6498 START WITH parent_id=0 CONNECT BY parent_id = PRIOR ID
SELECT CONNECT_BY_ROOT name, security_res_category.* FROM security_res_category where id=363 START WITH parent_id=0 CONNECT BY PRIOR id = parent_id;
SELECT CONNECT_BY_ISLEAF, security_res_category.* FROM security_res_category where id=963 START WITH parent_id=0 CONNECT BY parent_id = PRIOR ID;