我最近在oracle数据库上移动了我的一个项目。我已经创建了一个存储过程,用于从数据库中选择多行。以下是我的程序
create Or replace
PROCEDURE TEST(p_cursor OUT SYS_REFCURSOR) AS
BEGIN
open p_cursor FOR select * from branch_info;
END TEST;
当我执行此程序时,我收到以下错误:
*
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'SAURAV.TEST' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
我搜索了它并发现了类似的问题here,但错误行和原因不同。
任何人都可以帮我解决这个问题。
编辑:使用TEXT打印错误测试
答案 0 :(得分:1)
问题在于关键字测试
CREATE OR REPLACE PROCEDURE test (p_cursor OUT sys_refcursor)
AS
BEGIN
OPEN p_cursor FOR
SELECT *
FROM branch_info;
END test;
并按
执行variable rc refcursor;
exec test( :rc );
print rc;
ORA-06550: line 1, column 7:
PLS-00201: identifier 'TEST' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
更改为其他名称
CREATE OR REPLACE PROCEDURE test2 (p_cursor OUT sys_refcursor)
AS
BEGIN
OPEN p_cursor FOR
SELECT *
FROM branch_info;
END test2 ;
执行
variable rc refcursor;
exec test2 ( :rc );
print rc;
PL/SQL procedure successfully completed.
来自sql plus
SQL> variable usercur refcursor;
SQL> DECLARE
2 BEGIN
3 test2(:usercur);
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> print usercur;