不用存储过程就可以了
create table t1 as select * from t2;

解决方案 »

  1.   

    procedure myproc(myname varchar2)
    as
    type rec is record(
    name t1.name%type,
    age t1.age%type);
    rec1 rec;
    begin
    select name, age into rec1 from t1 where name=myname
    if sql%found then
        begin
    insert into t2(name, age)
    values (rec1.name, rec1.age);
        end;
    end if;
    exception
    when  no_data_found then 
    begin
    null ;
    end;
    end jiaonadyj;
    可以根据自己的需求更改一下.
      

  2.   

    我的一个表有很多记录不可能再重新创建的,而且我们保存数据都是用的存储过程,我是要在提交记录到一个表的同时,把指定的记录插入另一个表,但提交的记录是不完整的也要从提交记录到表的表中取出完整记录到插入的另一个表中,具体怎么做?最好给代码下面我给出一个示例
    create procedure fromtableinserttotable
    (
    ID in varchar2       ---表1中已有记录的ID号
    )
    is 
    begin
    -我要根椐这个ID 号从表1中提取的一条记录插入到表2中,
      而且两个表结构不完全相同end 
      

  3.   

    insert table_a values(b.col1,b.col2,.....) 
    as select b.col1,b.col2,...from table_b b
      

  4.   

    鳄鱼,这样会报错啊, 
      error:Compilation errors for PROCEDURE HISDICT.SET_ZY_PATIENTINHOS_ADVICEError: Compilation errors for PROCEDURE HISDICT.SET_ZY_PATIENTINHOS_ADVICEError: PLS-00103: 出现符号 "AS"在需要下列之一时:
           ,;returnreturning
    Line: 139
    Text: as select z.begin_person,   z.advice_propery,  z.item_type_name,   z.item_type_code,z.item_name,
      

  5.   

    不要as 
    insert table_a values(b.col1,b.col2,.....) 
     select b.col1,b.col2,...from table_b b
      

  6.   

    Error: PLS-00103: 出现符号 "("在需要下列之一时:
           ,;returnreturning
      

  7.   

    按下面的写SQL> insert into t3 select * from t1;4 行 已插入
      

  8.   

    还有一个问题:我按ID号查看表中有没有这条记录,然后要返回一个结果
     怎么写??
       ???  --这里怎么写?
        from t1
        where id = v_id
      

  9.   

    freddy2003:两个表结构不一样时你的代码也有用吗?