在oracle中关于树的sql
表task,字段id_,name_
id_的数据如下形式:
1
1.1
1.1.1
1.1.1.2
1.2
1.2.1
...
10
10.1
10.1.1
10.2.1
10.2.1.1
10.2.1.1.1
10.2.1.1.2
.......
注:“.”标识父子的关系。
现在通过id_查询树结构的效果,并且知道此节点是否为叶子节点leaf。。?
语句如下:
select
id_ ,
name_ ,
(select count(id_) from task where t.id_= substr(id_,0,INSTR((id_),'.',-1)-1) ) as leaf,connect_by_isleaf from task t
start with t.id_ ='5' connect by prior
t.id_= substr(t.id_,0,INSTR((t.id_),'.',-1)-1) order by t.id_
相关文档:
select p.spid,
a.serial#,
c.object_name,
b.session_id,
b.oracle_username,
b.os_user_name
from v$proces ......
在Oracle8i或以上版本中,可以创建以下两种临时表:
1。会话特有的临时表
CREATE GLOBAL TEMPORARY <TABLE_NAME> (<column specification>)
ON COMMIT PRESERVE ROWS;
2。事务特有的临时表
CREATE GLOBAL TEMPORARY <TABLE_N ......
There are lots of problems with Oracle DATE & TIMESTAMP and their
counterpart Java classes since they do not directly compare. DATE fields
in Oracle will give date & time where a ......