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: Cursor script hangs in loop

Re: Cursor script hangs in loop

From: Marco Pagan <marco.pagan_at_abb.it>
Date: 1998/03/05
Message-ID: <6dlm1e$1cl8$1@urano.inet.it>#1/1

Put the open cursor and the close cursor out of the loop.

Best regards
Marco Pagan marco.pagan_at_abb.it

Jim Lake ha scritto nel messaggio <34FDF949.5B5B1FB5_at_home.com>...
>I am trying to get a PL/SQL script to increment a column in a table. The
>
>following script is what I have come-up with, but it runs in a loop, and
>
>is a bear to kill. I have moved the close cursor inside and outside the
>loop, but still the same results. Thanks in advance for any help.
>
>DECLARE
> JIM_COUNTER NUMBER(10) := 0;
> HOLD_REC_KEY NUMBER(10);
> CURSOR COUNT_CURSOR IS
> SELECT REC_KEY FROM TEST_COUNTER FOR UPDATE OF REC_KEY;
>BEGIN
> LOOP
> OPEN COUNT_CURSOR;
> FETCH COUNT_CURSOR INTO HOLD_REC_KEY;
> IF COUNT_CURSOR%FOUND THEN
> JIM_COUNTER := JIM_COUNTER + 1;
> UPDATE TEST_COUNTER SET REC_KEY = JIM_COUNTER;
> ELSE
> EXIT;
> END IF;
> CLOSE COUNT_CURSOR;
> END LOOP;
>COMMIT;
>END;
>
>
>
Received on Thu Mar 05 1998 - 00:00:00 CST

Original text of this message

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