Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Incorrect PLS-00404

Re: Incorrect PLS-00404

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 06 Sep 1999 09:17:11 -0400
Message-ID: <rr7TN7Y8HWk4lNzDuHGe5DLua1jU@4ax.com>


A copy of this was sent to "Roy Brokvam" <roy.brokvam_at_conax.com> (if that email address didn't require changing) On Mon, 6 Sep 1999 14:26:17 +0200, you wrote:

>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

          of data

it (plsql) was looking for the OF columnname in addition to the 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

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Sep 06 1999 - 08:17:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US