用一个语句就可以了。insert into table2 select * from table1 where status = 4
写过程也是执行这样的一句。
create procdure test as 
beging
insert into table2 select * from table1 where status = 4;
end;

解决方案 »

  1.   

    ORA-06550: 第 2 行, 第 1 列: 
    PLS-00905: 对象 JDS.CHAT_RIGHT 无效
    ORA-06550: 第 2 行, 第 1 列: 
    PL/SQL: Statement ignored两个表结构要都一样的吗?
      

  2.   

    create procedure test
    as
    begin
    insert into table2 (col1,col2) select (col1,col2) from table1 where status=4;
    commit;
    end;
    /指定数据类型相同可以插入
      

  3.   

    select (col1,col2) from table1 where status=4;
    如果返回不只一条记录?
    insert into table2 (col1,col2) select (col1,col2) from table1 where status=4;
    也可行吗?
      

  4.   

    CREATE OR REPLACE PROCEDURE PLADM.PRO_ANABAT99002(in_table1     IN  VARCHAR2,
                     in_table2     IN  VARCHAR2
                                                )
    AS
    BEGIN
        INSERT in_table2
        (记录)
        VALUES (SELECT 记录
               FROM in_table1
               WHERE status=4
               )
    END;