在前台程序中处理,或在ORACLE中写存储过程。这问题不能用SQL语句实现

解决方案 »

  1.   

    select files col1,null col2 from tbldemo where length(files)<=15
      union
    select substr(files,1,15),substr(files,16) from tbldemo where length(files)>15
      

  2.   

    select files col1,null col2 from tbldemo where length(files)<=&&i
      union
    select substr(files,1,&&i),substr(files,&&i+1) from tbldemo where length(files)>&&i;
      

  3.   

    select a.files col1,b.files col2 from (select rownum no,files from tbldemo where rownum<16) a,(select rownum no,files from tbldemo where rownum<31) b
    where a.no+15=b.no(+);以上为假设表有<=30行。不过我觉得这样的SQL没什么意义,还是建议楼主在前台处理,我感觉这样的操作仅仅是为了显示数据(如报表)
      

  4.   

    To:ORARichard(没钱的日子好难过啊) 对!是这个意思。
    可能我表达不是很清楚!不好意思!
      

  5.   

    select files,null from tbldemo where rownum<=100
       union all
     (
       select null,files from tbldemo
         minus 
       select null,files from tbldemo where rownum<=100
     )
      

  6.   

    用报表工具去做吧,不应该这样通过SQL去解决这个问题。方法对了,才能有效的工作