- 浏览: 123659 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (165)
- 数据库 (45)
- 架构 (0)
- java web前端+框架 (9)
- java web后端+框架 (56)
- Eclipse插件 (1)
- 解题思路 (2)
- Eclipse (2)
- linux (6)
- jquery (4)
- 正则 (3)
- jsp (1)
- javascript (8)
- oracle (39)
- 生活 (1)
- weblogic (5)
- tomcat (3)
- Jrebel (1)
- powerdesigner (1)
- svn (1)
- log4j (1)
- IDE (1)
- POI (2)
- jvm (2)
- ssh (1)
- http (1)
- notepad++ (2)
- 润乾 (1)
- 设计模式 (0)
- 实用类Utils (2)
- 算法 (1)
- xml (1)
- 实用类 (2)
最新评论
select level
,lpad(' ', (level - 1) * 20, ' ') || t.fk_table as node_name --节点名称(带缩进)
,t.fk_name
,t.fk_table
,t.pk_name
,t.pk_table
from (select null as fk_name
,uta.table_name as fk_table
,null as pk_name
,null as pk_table
from user_tables uta
where not exists (select 1
from user_constraints uc
where uc.constraint_type = 'R'
and uc.table_name = uta.table_name)
union all
select a.constraint_name as fk_name
,a.table_name as fk_table
,b.constraint_name as pk_name
,b.table_name as pk_table
from user_constraints a
,user_constraints b
where a.constraint_type = 'R'
and b.constraint_type = 'P'
and a.r_constraint_name = b.constraint_name) t
start with t.pk_table is null
connect by prior t.fk_table = t.pk_table
--
;
从父节点查询子节点
start with t.pk_table is null
connect by prior t.fk_table = t.pk_table
从子节点查询父节点
start with t.fk_table = 'ASSIGN'
connect by prior t.pk_table = t.fk_table
--alias as child and parent
select level
,lpad(' ', (level - 1) * 20, ' ') || t.child_table as node_name --节点名称(带缩进)
-- ,t.node_name
,t.child_table
-- ,t.pk_name
,t.parent_table
from (select null as node_name
,uta.table_name as child_table
,null as pk_name
,null as parent_table
from user_tables uta
where not exists (select 1
from user_constraints uc
where uc.constraint_type = 'R'
and uc.table_name = uta.table_name)
union all
select a.constraint_name as node_name
,a.table_name as child_table
,b.constraint_name as pk_name
,b.table_name as parent_table
from user_constraints a
,user_constraints b
where a.constraint_type = 'R'
and b.constraint_type = 'P'
and a.r_constraint_name = b.constraint_name) t
start with t.parent_table is null
connect by prior t.child_table = t.parent_table
--
;
,lpad(' ', (level - 1) * 20, ' ') || t.fk_table as node_name --节点名称(带缩进)
,t.fk_name
,t.fk_table
,t.pk_name
,t.pk_table
from (select null as fk_name
,uta.table_name as fk_table
,null as pk_name
,null as pk_table
from user_tables uta
where not exists (select 1
from user_constraints uc
where uc.constraint_type = 'R'
and uc.table_name = uta.table_name)
union all
select a.constraint_name as fk_name
,a.table_name as fk_table
,b.constraint_name as pk_name
,b.table_name as pk_table
from user_constraints a
,user_constraints b
where a.constraint_type = 'R'
and b.constraint_type = 'P'
and a.r_constraint_name = b.constraint_name) t
start with t.pk_table is null
connect by prior t.fk_table = t.pk_table
--
;
从父节点查询子节点
start with t.pk_table is null
connect by prior t.fk_table = t.pk_table
从子节点查询父节点
start with t.fk_table = 'ASSIGN'
connect by prior t.pk_table = t.fk_table
--alias as child and parent
select level
,lpad(' ', (level - 1) * 20, ' ') || t.child_table as node_name --节点名称(带缩进)
-- ,t.node_name
,t.child_table
-- ,t.pk_name
,t.parent_table
from (select null as node_name
,uta.table_name as child_table
,null as pk_name
,null as parent_table
from user_tables uta
where not exists (select 1
from user_constraints uc
where uc.constraint_type = 'R'
and uc.table_name = uta.table_name)
union all
select a.constraint_name as node_name
,a.table_name as child_table
,b.constraint_name as pk_name
,b.table_name as parent_table
from user_constraints a
,user_constraints b
where a.constraint_type = 'R'
and b.constraint_type = 'P'
and a.r_constraint_name = b.constraint_name) t
start with t.parent_table is null
connect by prior t.child_table = t.parent_table
--
;
发表评论
-
oracle sql替换指定范围的字符串
2015-06-18 17:49 1024--oracle替换指定范围的字符串(范围4-6) selec ... -
oracle字符集修改 中文乱码
2015-03-30 15:06 908sqlplus / as sysdba;//操作系统用户认证模 ... -
转:ORACLE表空间管理维护
2015-03-27 11:25 503ORACLE表空间管理维护 2013-11-11 23:2 ... -
转:oracle层次查询 树查询 (详细)
2015-03-20 15:03 830oracle层次查询 转自:http://www.2cto. ... -
oracle树查询(叶子、带缩进)
2015-03-17 09:46 1277select t.func_id as func_id --I ... -
ORACLE表空间管理维护
2015-01-22 11:34 408http://www.cnblogs.com/kerrycod ... -
自写函数用于替换wm_concat函数.zip
2015-01-19 16:25 1173-- wm_concat出现在oracle10g版本中,不仅是 ... -
禁用启用所有外键约束.tst
2015-01-12 11:05 550禁用所有外键约束.tst declare cursor c ... -
oracle查询生成列别名
2015-01-06 15:00 403select ',' ,col.COLUMN_NA ... -
linux下重启oracle
2015-01-05 15:44 505oracle/oracle连接ssh后 登录数据库 ... -
分页帮助类-oracle-java
2014-10-09 17:46 427/** * 分页帮助类 * * @author ver ... -
Oracle 列转行函数 Listagg()
2014-09-25 13:54 467Oracle 列转行函数 Listagg() 博客分类: O ... -
oracle删除重复记录
2014-08-22 15:49 327delete from cred_account ca1 w ... -
oracle获取过程的错误异常代码,错误,异常栈信息
2014-08-22 15:19 293得到oracle异常行号,代码,异常栈信息 Sql代码 d ... -
数据库导入导出dump.txt
2014-07-28 10:26 415数据库导入导出dump -
Oracle分组分段统计-sum+case when+group by使用实例
2014-06-13 09:30 1334实例演示: (1)查询表users中的数据。 ... -
oracle表空间管理
2014-04-24 11:15 688--查看修改ORACLE表空间 --1、查看所有表空间信息 s ... -
连接到sqlplus
2014-04-17 11:25 421root/passwd su - oracle sqlplus ... -
0001-Oracle-系统-视图
2014-03-29 09:59 429--oracle树查询 select * from FUNC ... -
ORACLE查看并修改最大连接数
2014-03-26 13:52 526ORACLE查看并修改最大连接数 第一步,在cmd命令行,输入 ...
相关推荐
oracle树状结构查询即层次递归查询,是sql语句经常用到的,在实际开发中组织结构实现及其层次化实现功能也是经常遇到的。这篇文章给大家介绍了Oracle递归树形结构查询功能,需要的朋友参考下
Oracle 多表查询优化
例如: 两表(多表)关联update -- 仅在where字句中的连接 --这次提取的数据都是VIP,且包括新增的,所以顺便更新客户类别 update customers a -- 使用别名 set customer_type='01' --01 为vip,00为普通 where ...
oracle两表关联更新Demo,使用exists嵌套子查询实现两表关联更新
sql多表关联查询
NULL 博文链接:https://l007it.iteye.com/blog/849897
--客户资料表 create table customers ( customer_id number(8) not null, -- 客户标示 city_name varchar2(10) not null, -- 所在城市 customer_type char(2) not null, -- 客户类型 ... ) create ...
oracle锁表查询oracle锁表查询oracle锁表查询oracle锁表查询
WHERE 表1.A = 表2.A) WHERE EXISTS (SELECT 1 FROM 表1 WHERE 表1.A = 表2.A); 尤其注意最后的外层where条件尤为重要,是锁定其批量更新数据的范围。 方法二: MERGE INTO 表2 USING 表1 ON (表2.A = 表1.A...
ORACLE ebs 各个模块的表之间的关联关系,方便大家熟悉ebs系统的表结构
Oracle基础查询关联查询练习题.docx
主要介绍了Oracle中多表关联批量插入,批量更新与批量删除操作,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
oracle查询表碎片语句
不错,收集在一块方便查看 这里提供的是执行性能的优化,而不是后台数据库优化器资料: 参考数据库开发性能方面的各种问题,收集了一些优化方案统计如下
oracle菜单树查询 使用实例 使用START WITH CONNECT BY PRIOR子句实现递归查询
OracleOracle查询死锁表OracleOracle查询死锁表OracleOracle查询死锁表
一.数据库表关联,二、聚合函数,三.oracle常用的函数,四.联合查询,五.分页查询, 六.exists 的用法:七.模糊查询
oracle表连接和子查询实例 所有的实例查询都包含在里面,不会担心笔试oracle子查询。
oracle系统表查询,详细讲解各个系统表的使用
一些ORACLE的表链接查询。求最高,最低,排序