PL/SQL loop problem

From: Gaggl Paul <Paul.Gaggl_at_wifo.ac.at>
Date: Mon, 12 Aug 2002 15:16:19 +0200
Message-ID: <3D57B523.63BA46D9_at_wifo.ac.at>



Hey!

[Quoted] [Quoted] I have a loop structure like the following:

open cursor;
loop

    fetch cursor into line;
    if cursor%NOTFOUND
    then

            update
    end if;

    if

        update
    elsif

        update
    end if;

end loop;

As you can see i want to update the last record twice if one of the if conditions
is true. The problem now is, where to put the commit statement. If i put the commit
statement outside the loop the last update is "left out" because the modified record
can not be found, because it has not yet been modified. If i put the commit statement inside the loop i get a "cursor out of sequence" exception.

Has anyone of you an idea what to do here?

Paul

-- 
___________________________________________________________________

Österreichisches Institut für Wirtschaftsforschung     WIFO

Name:	Paul Gaggl		Postadresse: 	Postfach  91
Tel.:   +43-1-7982601-229			A-1103  Wien      
Fax:    +43-1-7989386		Standort: 	Arsenal Objekt 20
Mail:	gaggl_at_wifo.ac.at			A-1030  Wien 

http://www.wifo.ac.at/
Received on Mon Aug 12 2002 - 15:16:19 CEST

Original text of this message