在Oracle中的树形操作
在Oracle中的树形操作
1.取子节点及路径(正树):
select t.id ,t.code, t.name ,t.pid
,SYS_CONNECT_BY_PATH(t.id,'.')||'.' as IdPath
from tas_catalog t
--where id!=110
start with id=110
connect by pid = prior id
order siblings by id
2.取各级父节点(倒树):
select t.id ,t.code, t.name ,t.pid
,SYS_CONNECT_BY_PATH(t.id,'.')||'.' as IdPath --路径从反的
from tas_catalog t
--where id!=110
start with id=110
connect by id = prior pid
order siblings by id
无论正树还是倒树, 关键就在于connect by的条件.
正树: 必须是 ‘父’= prior ‘子’
倒树: 必须是 ‘子’= prior ‘父’
相关文档:
1、什么是存储过程。存储过程是数据库服务器端的一段程序,它有两种类型。一种类似于SELECT查询,用于检索数据,检索到的数据能够以数据集的形式返
回给客户。另一种类似于INSERT或DELETE查询,它不返回数据,只是执行一个动作。有的服务器允许同一个存储过程既可以返回数据又可以执行动作。
2、什么时候需要用存储过程
......
MySQL的ID非常方便定义,只要指定其字段的自动增量属性即可。
但是Oracle不行,需要定义sequence和triggedr,当然trigger可以不定义,但是不方便。
表定义如下:
CREATE TABLE GAME
(
ID
INTEGER ......
Oracle 的管理可以通过OEM或者命令行接口。 Oracle Clusterware的命令集可以分为以下4种:
节点层:osnodes
网络层:oifcfg
集群层:crsctl, ocrcheck,ocrdump,ocrconfig
应用层:srvctl,onsctl,crs_stat
下面分别来介绍这些命令。
一. 节点层
只有一个命令: osnodes, 这 ......
Lately,
Jordan bank upgraded their ICBS banking software to Oracle 9i and
IDS9i. The Bank also moved from a decentralized to a centralized
system.
We were contracted to monitor and diagnose performance issues during the launching phase of the new system.
The IBM server was equipped with 32 GB o ......
1z0-047 资料的最新分享,下面一些题目是从最新的题库中精心整理出来的,质量很高,需要的朋友看过来的啊。
1. Which statements are true? (Choose all that apply.)
A. The data dictionary is created and maintained by the database administrator.
B. The data dictionary views can consist of joins of dictiona ......