[英]PLS-00201: identifier 'CURSOR' must be declared
I saw that have many similar questions here in stackoverflow but no one answer my question. 我在stackoverflow中看到有很多类似的问题,但是没有人回答我的问题。
Where is the problem ? 问题出在哪儿 ?
CREATE OR REPLACE
PROCEDURE "PR_TESTE"( sl_cursor OUT SYS_REFCURSOR)
IS
stm varchar(30000);
BEGIN
stm := 'SELECT * from tb_device_type';
OPEN sl_cursor FOR stm ;
END;
There is no problem in your code. 您的代码没有问题。 The problem could be in the function/proc calling this procedure.
问题可能出在调用此过程的函数/过程中。 Make sure that the cursor is defined there.
确保在此处定义了光标。 I replaced your table tb_device_type to tab.
我将您的表tb_device_type替换为tab。 This snippet works fine.
此代码段效果很好。
CREATE OR REPLACE
PROCEDURE "PR_TESTE"( sl_cursor OUT SYS_REFCURSOR)
IS
stm varchar(30000);
BEGIN
stm := 'SELECT * from tab';
OPEN sl_cursor FOR stm ;
END;
-----
declare
l_cur sys_refcursor;
l_tname tab.tname%type;
l_tabtype tab.tabtype%type;
l_clusterid tab.clusterid%type;
begin
pr_teste(l_cur);
loop
fetch l_cur into l_tname, l_tabtype, l_clusterid;
exit when l_cur%notfound;
dbms_output.put_line(l_tname);
end loop;
end;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.