| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Usenet -> c.d.o.server -> Incorrect PLS-00404
Oracle7 Server 7.3.4.1.0
PL/SQL 2.3.4.1.0
My package is rejected by the database! I am certain that the syntax is
correct:
SQL> CREATE OR REPLACE PACKAGE mytest AS
  2   FUNCTION func ( p_id NUMBER ) RETURN NUMBER;
  3  END mytest;
  4  /
Package created.
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY mytest AS
  2   CURSOR cur ( p_id NUMBER ) IS
  3    SELECT id,data
  4    FROM tab
  5    FOR UPDATE
  6    NOWAIT;
  7
  7   FUNCTION func ( p_id NUMBER )
  8   RETURN NUMBER IS
  9    rec mytest.cur%ROWTYPE;
 10   BEGIN
 11    OPEN mytest.cur( p_id );
 12    FETCH mytest.cur INTO rec;
 13    UPDATE tab SET data = rec.data + 1
 14    WHERE CURRENT OF mytest.cur;
 15    CLOSE mytest.cur;
 16    RETURN rec.id;
 17   END func;
 18  END mytest;
 19  /
Warning: Package Body created with compilation errors.
SQL> show errors package body mytest
Errors for PACKAGE BODY MYTEST:
LINE/COL ERROR
-------- -----------------------------------------------------------------
13/3     PL/SQL: SQL Statement ignored
14/27    PLS-00404: cursor 'MYTEST.CUR' must be declared with FOR UPDATE
to use with CURRENT OF
SQL> spool off
--
Roy Brokvam
Theory is when you know why it doesn't work.
Practice is when it works, but you don't know why.
We combine theory and practice;
It doesn't work, and we don't know why.
Received on Mon Sep 06 1999 - 07:26:17 CDT
|  |  |