我想在存储过程中使用游标.把mytable表中的数据取出来插入temTable(临时表)中去.但是老是报错.不知道是什么原因.请大家指点一下
LINE/COL ERROR
-------- -----------------------------------------------------------------
7/3      PL/SQL: Statement ignored
7/17     PLS-00201: 必须说明标识符 'MYCORSOR'
 create or replace package body mypackage is
procedure doit is
  cursor mycursor is select * from mytable;
theRow mycursor%rowType;
begin   
for theRow in mycorsor loop
insert into temTable values(theRow.id,theRow.name,theRow.palce);
end loop;
end doit;
end mypackage;

解决方案 »

  1.   

    create or replace package body mypackage is
    procedure doit is
    begin  
    insert into temTable 
    select id,name,place from mytable;
    end doit;
    end mypackage;
    --不需要用游标就可以解决
      

  2.   

    create or replace package body mypackage is
    procedure doit is
      cursor mycursor is select * from mytable;
    theRow mycursor%rowType;
    begin  
    for theRow in mycorsor loop   --写错了  mycorsor 改成 mycursor
    insert into temTable values(theRow.id,theRow.name,theRow.palce);
    end loop;
    end doit;
    end mypackage;--定义的时候是mycursor,你用的时候写成了mycorsor
      

  3.   

    看这里:
    教你在Oracle存储过程中如何使用游标