在net中执行,sql="with t2 as (select * from t1) select * from t2" 语句时,为什么不能读出数据呢?我是想用with这个功能来做组合查询。请指点

解决方案 »

  1.   

    這倏SQL能在SQL/PLUS中執行嗎????
      

  2.   

    在sql/plus中不能执行,但是在oracle下可以执行
      

  3.   

    实现这个功能的sql语法很多,为什么非要用这个形式的
      

  4.   

    with aaa as 
    (select 'aaa' 单位 ,'20100101' 日期,'A'票符 , 1 起号  , 3 至号 from dual union all
     select 'aaa','20100101','A' ,4, 8  from dual union all
     select 'bbb','20100102','B' ,1, 9  from dual union all
     select 'bbb','20100102','B' ,4, 20 from dual union all
     select 'ddd','20100103','C' ,12, 19 from dual union all
     select 'ddd','20100103','C' ,22, 40 from dual),
     b as (
            select a.单位,a.日期,a.票符,level ,CONNECT_BY_ROOT a.起号 起号,a.至号 至号,CONNECT_BY_ISLEAF leaf
              from aaa a 
              start with not exists (select 'X'
                                       from aaa a2 
                                      where a2.票符=a.票符 
                                            and a2.至号=a.起号-1
                                    )
            connect by prior a.票符=a.票符 
                       and  prior   a.至号+1=a.起号
         ) 
    select b.单位,b.日期,b.票符,min(b.起号),b.至号 
      from b 
     where b.leaf=1 
     group by b.票符,b.至号,b.单位,b.日期我是要实现这样一个功能,但是在net中执行后跟踪调试没有数据读出?