oracle高手请进,下面pl/sql 块错在那里??

difficult 2002-03-01 05:36:50
declare
type newStruct is record(
c1 number,
c2 number
);
type NTab is table of newStruct;
type Cursortype is ref cursor;
nList NTab:=NTab();
myCursor Cursortype;

begin

nList.extend;
nList(1).c1:=1;
nList(1).c2:=2;
nList.extend;
nList(2).c1:=11;
nList(2).c2:=22;
dbms_output.put_line(nList(1).c1);
dbms_output.put_line(nList(1).c2);
dbms_output.put_line(nList(2).c1);
dbms_output.put_line(nList(2).c2);

--此句出错
open myCursor for SELECT t.* FROM TABLE(nList) t ;
--open myCursor for SELECT * FROM TABLE(CAST(nList AS NTab)) t ;
end;


-----------------------------------------
执行后出错信息:
declare
*
ERROR 位于第 1 行:
ORA-00600: internal error code, arguments: [15419], [severe error during PL/SQL
execution], [], [], [], [], [], []
ORA-06544: PL/SQL: internal error, arguments: [pfrrun.c:pfrbnd1()], [], [], [],
[], [], [], []
ORA-06553: PLS-801: internal error [0]
...全文
78 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zzyy 2002-03-04
  • 打赏
  • 举报
回复
你的SQL SELECT FIELDNAME FROM TABLENAME
其中FIELDNAME和TABLENAME是用变量表示的,那么在DBMS分析你的SQL时
不知道变量的含义。所以上述SQL要用动态SQL实现
Fxx 2002-03-04
  • 打赏
  • 举报
回复
还有:
open myCursor for 'SELECT t.* FROM ' ||TABLE(nList) t;
sql语句的非变量部分必须用单引号
Fxx 2002-03-04
  • 打赏
  • 举报
回复
游标定义错误
Type RefcurT is Ref Cursor;
myCursor RefcurT;
open myCursor for .....

23,409

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧