代码跟错误提示如下
declare
type title_record is record
(title varchar2(60),
subtitle varchar2(60) );
type title_collection is table of title_record;
lv_title_collection title_collection;
cursor c is
select item_title,item_subtitle
from item;
begin
open c;
loop
fetch c bulk collect into lv_title_collection limit 20;
exit when lv_title_collection.count=0;
for i in 1..lv_title_collection.count loop
dbms_output.put_line('title ['||lv_title_collection(i).title||']');
end loop;
end loop;
close c;
end;
错误提示如下:
ORA-06550: 第 9 行, 第 19 列:
PL/SQL: ORA-00904: "ITEM_SUBTITLE": 标识符无效
ORA-06550: 第 9 行, 第 1 列:
PL/SQL: SQL Statement ignored
------解决方案--------------------------------------------------------
select item_title,item_subtitle from item;
你确定item表中有item_title这个字段?
------解决方案--------------------------------------------------------
查看item表是否有item_subtitle字段
------解决方案--------------------------------------------------------
select item_title,item_subtitle
from item;
这里问题 item表是否有item_subtitle字段
------解决方案--------------------------------------------------------
把这个存储过程用到的所有表的建表语句贴一下,可以帮你实测一下。
可以在SQL*Plus中或在PL/SQL Developer的命令窗口中执行:
desc item; // 查看字段名你写的是否正确。
------解决方案--------------------------------------------------------
好像没有item这个表,确定是要现有item这个表吗,而不是在oracle 11g中已经存在的表
------解决方案--------------------------------------------------------
没有这表的话,那下面这游标你定的有问题,看item是视图或同义诃或是表?
cursor c is select item_title,item_subtitle from item
------解决方案--------------------------------------------------------
没有对应的表、视图或其他对象,
select item_title,item_subtitle from item; 这句话如何执行?