start with ... connect by ... prior 实例
来源:互联网 发布:近视手术知乎 编辑:程序博客网 时间:2024/06/01 08:46
创建表的脚本及测试数据
CREATE TABLE TABLE1
(
UUID VARCHAR2(20 BYTE),
XUHAO VARCHAR2(20 BYTE),
PRICE NUMBER(10,2)
)
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('001', '3', 140);
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('002', '3.1', 140);
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('003', '3.1.1', 50);
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('004', '3.1.1.1', 20);
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('005', '3.1.1.2', 30);
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('006', '3.1.2', 90);
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('007', '3.1.2.1', 40);
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('008', '3.1.2.2', 50);
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('009', '4', 136);
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('010', '4.1', 70);
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('011', '4.2', 66);
Insert into TABLE1
(UUID, XUHAO, PRICE)
Values
('012', '5', 90);
COMMIT;
得到所叶子及没有叶子的节点:
select * from table1 a
where connect_by_isleaf=1
start with length(xuhao)=1
connect by xuhao like prior xuhao||'.%'
and xuhao not like prior xuhao||'.%.%'
- start with ... connect by ... prior 实例
- connect by prior start with
- connect by prior start with
- CONNECT BY PRIOR... START WITH
- connect by prior start with
- Start With......Connect by prior..
- start with connect by prior
- connect by prior...start with...
- start with ... connect by prior ...
- start with ... CONNECT BY PRIOR
- start with --connect by prior
- START WITH CONNECT BY PRIOR
- start with connect by prior
- Oracle start with..Connect By prior..用法实例讲解
- connect by prior start with 总结
- connect by prior start with 用法
- connect by prior start with语句详解
- start with...connect by prior子句用法
- sql study 1
- arm-linux-gcc/ld/objcopy/objdump使用总结
- 3gp或者mp4文件的duration长度为0,在SampleIterator::seekTo函数返回错误码-1007
- POJ 1011 Sticks
- 跟踪内存分配
- start with ... connect by ... prior 实例
- 【转】Excel 使用技巧集锦——163种技巧
- ExtJS Grid 按条件加载数据
- 关于浏览器内核的一些概念
- Delphi IDhttp 获取Cookie
- 线性时间选择
- 罗裳轻解,看C++怎样拥java入怀……
- 【转】理解JavaScript函数 函数传参
- 观察者模式