insert into b 
select id,tt,x1,y1,x2,y2,x3,y3,x4,y4 from a
union all
select id,tt,x5,y5,x6,y6,x7,y7,x8,y8 from a
union all
...
union all
select id,tt,x29,y29,x30,y30,x31,y31,x32,y32 from a;

解决方案 »

  1.   

    楼主没有理解bzszp的意思吧bzszp只是一条复合语句啊,跟行数没关系,跟列数有关。
      

  2.   

    参考一下怎么用存储过程实现declare
        cursor cur is select * from a;
    tab     a%rowtype;
    t_command    varchar2(100);
    i       integer;
    begin
        open cur;
       <<loop1>>
       loop
       fetch cur into tab;
       exit when cur%notfound;
       i:=1;
         <<loop2>>
         while i<30  loop
         t_command:='insert into b value (tab.id, tab.tt, tab.x'||i||', tab.x'||i+1||
     ', tab.x'||i+2||', tab.x'||i+3||', tab.x'||i+4||')';
     execute immediate t_command;
     i:=i+4;
     end loop loop2;
       end loop loop1;
    close cur;
    end;
      

  3.   

    没有必要用存储过程.建议楼主还是先了解一下sql语句.先对create table tname as select .....
    作个测试有个了解之后再作操作.这样能加深体会@!
      

  4.   

    我想楼主的问题不是这样的吧,因为楼主未在问题中说明表A各行的关系,我认为是如下关系,不知道最不对,还请楼主确认
    1、在表A中对于每个TT,X32、Y32对应下一行的X1、Y1,因此表A中的记录是将一条长链分割成若干行,每行有32组坐标,而现在要做的是每行4组坐标。
    2、id字段的作用,按id递增排列每个TT的坐标
    3、在表A中的每个TT的坐标结束标志是什么?