Oracle 遍历树 start with () connect by prior ()
来源:互联网 发布:mysql常用命令总结 编辑:程序博客网 时间:2024/05/02 19:16
自上而下遍历
select o.* from t_cc_object o start with o.objectid = 1000000000000001 connect by prior o.objectid = o.parentid
由下面的数据可知:遍历是从一个树枝遍历到底,再遍历第二个。
自下而上遍历
select o.* from t_cc_object o start with o.objectid = 1000000000005324 connect by prior o.parentid = o.objectid
数据结构:
表结构:
-- Create table
create table T_CC_OBJECT
(
OBJECTID NUMBER(16) not null,
OBJECTTYPEID NUMBER(16) not null,
TOTALCODE NVARCHAR2(64),
ENABLED NCHAR(1) default '1',
OBJECTCODE NVARCHAR2(64),
OBJECTNAME NVARCHAR2(128) not null,
AUTOINCREASE NUMBER,
DESCRIPTION NVARCHAR2(256),
PARENTID NUMBER(16),
GENERATION NUMBER,
OBJECTPOSITION NUMBER not null,
HASCHILDREN NCHAR(1) default '0',
CREATETIME DATE
)
tablespace CC_ECS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
next 1
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table T_CC_OBJECT
add constraint PK_T_CC_OBJECT primary key (OBJECTID)
using index
tablespace CC_ECS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- Create/Recreate check constraints
alter table T_CC_OBJECT
add constraint CKC_ENABLED_T_CC_OBJ
check (Enabled is null or (Enabled in ('1','0')));
alter table T_CC_OBJECT
add constraint CKC_HASCHILDREN_T_CC_OBJ
check (hasChildren is null or (hasChildren in ('0','1')));
-- Create/Recreate indexes
create index IDX_OBJECT_OBJECTNAME on T_CC_OBJECT (OBJECTNAME)
tablespace CC_ECS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
create index IDX_OBJECT_PARENTID on T_CC_OBJECT (PARENTID)
tablespace CC_ECS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
create index I_CC_OBJECT_TOTALCODE on T_CC_OBJECT (TOTALCODE)
tablespace CC_ECS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
- Oracle 遍历树 start with () connect by prior ()
- oracle树结构查询(start with connect by prior )
- oracle树操作(select .. start with .. connect by .. prior)
- ORACLE查询树型关系(connect by prior start with)
- ORACLE查询树型关系(connect by prior start with)
- ORACLE查询树型关系(start with connect by prior)
- ORACLE查询树型关系(connect by prior start with)
- 【转】ORACLE查询树型关系(start with connect by prior)
- ORACLE查询树型关系(connect by prior start with)
- ORACLE查询树型关系(start with connect by prior)
- Oracle查询树型关系(start with connect by prior)
- Oracle start with ... connect by prior 用法
- Oracle中start with...connect by prior
- Oracle start with...connect by prior用法
- Oracle start with connect by prior 用法
- oracle中start with connect by prior
- Oracle中connect by prior .... start with
- oracle start with connect by prior函数
- 数据文件从系统文件迁移到asm的操作
- cin,cin.get(),cin.getline()的深入分析
- 使用 GPG 签名 Git Commits
- Android 自定义九宫格解锁
- 【Linux】CentOS下vsftpd报500\550的解决方法
- Oracle 遍历树 start with () connect by prior ()
- Cocos2dx-lua坐标系
- 对CTO这个角色的一些个人看法
- 软考之数据库技术基础
- Myeclips的使用记录
- 视频汇聚云平台——千眼一平台
- 设置favicon的几种方式
- 一、node (Express) Ejs Angular 移动端开发
- Chromium插件(Plugin)制简要介绍和学习计划