insert into table1(name) select 'table1'||name from table2

解决方案 »

  1.   

    oracle2个数据字典
    你desc一下就知道了
    ALL_TABLES: Description of tables accessible to the user 
    ALL_COL_COMMENTS :COMMENTS Comments on columns of accessible tables and views  
      

  2.   

    insert into table1(name) select 'table1-'||name from table2
      

  3.   

    create table table2 as select 'table1-'||name name2 from table1
      

  4.   

    说明一下,table1和table2里面还有别的字段。所以还有别的value值需要添加。而不是只是从table2里面select出来的,它只是其中一列的值。
      

  5.   

    用过程实现比较方便
    create or replace procedure name_pro
    as
    cursor t_sor is 
    select name1,name2,.. from table2;
    begin
    for v_sor in t_sor loop
    insert into table1 (name1,name2,...) values('table1-'||v_sor.name1,'table1-'||v_sor.name2,...);
    end loop;
    end;
    /
      

  6.   

    上面的过程可以这样执行:
    SQL>execute name_pro;
    如果你不想上面的过程保存在数据中的话,可以修改成
    declare
    cursor t_sor is 
    select name1,name2,.. from table2;
    begin
    for v_sor in t_sor loop
    insert into table1 (name1,name2,...) values('table1-'||v_sor.name1,'table1-'||v_sor.name2,...);
    end loop;
    end;
    /
    当然你也可以用完了以后把它删掉(drop)