首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

Oracle游标声明报错,该如何处理

2013-11-29 
Oracle游标声明报错游标声明:declare cursor cs_table_students is select id from table_studentsstuden

Oracle游标声明报错
游标声明:
declare cursor cs_table_students is select id from table_students;student_id table_students.id%type;

报错信息:
ORA-06550: 第 4 行, 第 0 列: 
PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
 begin function
   pragma procedure subtype type <an identifier>
   <a double-quoted delimited-identifier> current cursor delete
   exists prior

表格信息:
ID         NAME                 TELEPHONE
001        alice                136166
002        peter                136167
003        jack                 136168

请问错在哪里呢,书上和网上都是这么写的,为什么到我这就出错了?我想要知道为什么错了,不只是怎么写正确。
oracle 游标 数据库 SQL 数据库报错
[解决办法]

引用:
游标声明:
declare cursor cs_table_students is select id from table_students;student_id table_students.id%type;

报错信息:
ORA-06550: 第 4 行, 第 0 列: 
PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
 begin function
   pragma procedure subtype type <an identifier>
   <a double-quoted delimited-identifier> current cursor delete
   exists prior

表格信息:
ID         NAME                 TELEPHONE
001        alice                136166
002        peter                136167
003        jack                 136168

请问错在哪里呢,书上和网上都是这么写的,为什么到我这就出错了?我想要知道为什么错了,不只是怎么写正确。

如果你代码不是很多请把你的代码全部贴出来看看,如果很多请贴关键部分
[解决办法]
最近一点,定义变量的时候只能在DECLARE和BEGIN之间,否则也会报PLS-00103
[解决办法]
楼主发帖为什么又不把代码格式化下呢
让别人去猜?
[解决办法]
是不是哪里没写分号或者引号
[解决办法]
都没有BEGIN END怎么编译过?
如果你要测试声明可以这样:

declare cursor cs_table_students is select id from table_students;student_id table_students.id%type;
begin
NULL;
END;

经测试,这样声明是完全没问题的

热点排行