PLSQL检查游标是否为ISOPEN的问题

问题描述 投票:0回答:1

我试图达到的目的是检查游标是否打开,以确保安全,但是我总是会收到此错误。任何形式的帮助将不胜感激。

LINE/COL ERROR
-------- -----------------------------------------------------------------
29/5     PL/SQL: SQL Statement ignored
29/5     PLS-00306: wrong number or types of arguments in call to
         'WROTE_CUR'

CREATE OR REPLACE PROCEDURE print_publication (p_name CHAR) AS

CURSOR wrote_cur (v_AID NUMBER) IS
 SELECT AID,PUBID FROM wrote WHERE AID = v_AID;

 v_wrote_rec wrote_cur%ROWTYPE;

BEGIN

IF NOT wrote_cur%ISOPEN THEN
OPEN wrote_cur;
END IF;


 CLOSE wrote_cur;

END;
/
plsql plsqldeveloper
1个回答
1
投票

您用输入Argument声明了光标。

CURSOR wrote_cur (v_AID NUMBER) IS --<-- Cursor is expecting argument at runtime

虽然在Begin块中,您没有将任何参数传递给游标。

 OPEN wrote_cur; --<-- Here..

像这样传递参数:

 OPEN wrote_cur(1);

0
投票

错误:忘记传递参数

  IF NOT wrote_cur%ISOPEN THEN
    OPEN wrote_cur (v_author_ID);
  END IF;
© www.soinside.com 2019 - 2024. All rights reserved.