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: Need help with "for update" cursor

Re: Need help with "for update" cursor

From: Sybrand Bakker <postmaster_at_sybrandb.demon.nl>
Date: Tue, 14 Sep 1999 20:44:41 +0200
Message-ID: <937334743.20380.0.pluto.d4ee154e@news.demon.nl>


You can't use for update in a ref cursor. You need to use an ordinary cursor to accomplish this.

Hth,

--
Sybrand Bakker, Oracle DBA

Rui Chambel <REMOVE_THISrchambel_at_netscape.net> wrote in message news:937332607.325409_at_orodruin.esoterica.pt...
> Hi,
>
> I'm new with Oracle and need help on this one.
>
> I need a cursor from one simple table and need to update one row at a
time.
>
> I'm using Oracle 8, and keep getting this message "PLS-00413: identifier
in
> CURRENT OF clause is not a cursor name
>
> This is what I did:
>
>
> TYPE TNomAnu IS REF CURSOR RETURN import_nomanu%ROWTYPE;
>
> nomanu_cursor TNomanu;
> nomanu_rec import_nomanu%ROWTYPE;
>
> -- These two have the same size as the columns I'm trying to update
> NEW_MORADA VARCHAR2(200);
> NEW_MORADA_PROC VARCHAR2(12);
>
> begin
>
> OPEN nomanu_cursor FOR
> SELECT * FROM import_nomanu
> WHERE MORADA_PROC IS NULL
> FOR UPDATE;
>
> LOOP
> /* Fetch from cursor variable. */
> FETCH nomanu_cursor INTO nomanu_rec;
>
> EXIT WHEN nomanu_cursor%NOTFOUND; -- exit when last row is fetched
>
> -- Please note I'm not doing anything here... the logic will be placed
> here
>
> UPDATE import_nomanu
> SET MORADA=NEW_MORADA, MORADA_PROC=NEW_MORADA_PROC
> WHERE CURRENT OF nomanu_cursor;
>
> -- This is where I get the Error ---^
>
> END LOOP;
> CLOSE nomanu_cursor;
>
> exception
>
> when others then
> null;
>
> end;
>
>
> Can anyone help me?
>
> Many thanks in advance,
> Rui Chambel
>
> --
> ------------------------------------------------
> Rui Chambel
> - Portugal -
> Delphi, C++, VB, Java, SQL, I*net
> e-mail: rchambel_at_netscape.net
> ------------------------------------------------
> Make your life simple:
> Write your own programs!
> ------------------------------------------------
>
>
>
>
Received on Tue Sep 14 1999 - 13:44:41 CDT

Original text of this message

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