我想在存储过程中使用游标.把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;
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;
解决方案 »
- 请问如何将sybase数据库中的表转入到oracle 10g中
- PL/SQL 复杂统计问题,高手来解
- 各位大侠,帮忙写一个存储过程,关于2个表数据比对
- 急求救:改动init.ora文件,8i就无法启动
- 想接触ORACLE,请朋友们给推荐些好书,十分感谢。
- 初学oracle前提必须懂得那些最基本的东西?
- oracle 8.1.7导出的.dmp文件如何导入到oracle 8.0.5?
- ORACLE是垃圾,不折不扣的垃圾
- 关于IMP命令的疑问
- 我机器上连接oracle过一会就会停掉,是什么原因?
- 关于oracle游标的问题。
- 高手们帮忙: 用decode()和case when end那个效率高啊。
procedure doit is
begin
insert into temTable
select id,name,place from mytable;
end doit;
end mypackage;
--不需要用游标就可以解决
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
教你在Oracle存储过程中如何使用游标