zoukankan      html  css  js  c++  java
  • oracle connect by 和start with

    网上找了个例子 测试了一下 貌似明白了
    create table t2(
    root_id number,
    id number,
    name varchar(5),
    description varchar(10)
    );

    insert into t2(root_id,id,name,description) values(0,1,'a','aaa');
    insert into t2(root_id,id,name,description) values(1,2,'a1','aaa1');
    insert into t2(root_id,id,name,description) values(1,3,'a2','aaa2');
    insert into t2(root_id,id,name,description) values(0,4,'b','bbb');
    insert into t2(root_id,id,name,description) values(4,5,'b1','bbb1');
    insert into t2(root_id,id,name,description) values(4,6,'b2','bbb2');

    1.jpg 

    select * from t2 start with root_id = 0 connect by prior id = root_id
    2.jpg 

    select * from t2 start with id = 1 connect by prior id = root_id;
    3.jpg 


    select * from t2 start with id = 4 connect by prior id = root_id;
    4.jpg 

    select * from t2 start with root_id = 0 connect by id = root_id;

    5.jpg 
    select * from t2 start with id = 1 connect by id = root_id;

    6.jpg 

     
  • 相关阅读:
    C++输入cout与输出cin
    golang学习笔记
    vscode环境配置
    golang 微框架 gin
    git go使用socket5代理
    go包管理工具glide
    collectd的python插件(redis)
    zookeeper & kafka 集群
    redis复制集(sentinel)
    python加解密
  • 原文地址:https://www.cnblogs.com/softidea/p/3838705.html
Copyright © 2011-2022 走看看