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

Home -> Community -> Usenet -> c.d.o.misc -> Re: cursor/update freezes

Re: cursor/update freezes

From: Andy Hardy <aph_at_ahardy.demon.co.uk>
Date: Thu, 16 Mar 2000 14:22:10 +0000
Message-ID: <$$ettAAS4O04Ewcw@ahardy.demon.co.uk>


In article <953211533.174983_at_newsreader2.wirehub.nl>, Thomas Sjoerdsma <t_sjoerdsma_at_hotmail.com> writes
>Hi
>
>i use the following cursor/update methode but the system freezes while
>running the program in wich this sql is embedded.
>Does anybody have an idea why????
>
>Thanks
>
>EXEC SQL WHENEVER NOT FOUND DO break;
>EXEC SQL DECLARE emp_cursor CURSOR FOR SELECT AMOUNT FROM SYS.BP_DECO WHERE
>DEALER_ID = :searchkey FOR UPDATE OF AMOUNT;
> EXEC SQL OPEN emp_cursor;
> for(;;) {
> EXEC SQL FETCH emp_cursor INTO :mamount;
> EXEC SQL UPDATE SYS.BP_DECO SET AMOUNT = 10
> WHERE CURRENT OF emp_cursor;
> }
> EXEC SQL CLOSE emp_cursor;
> EXEC SQL COMMIT;
>
>
>

The FOR UPDATE clause will lock *all* eligible rows before the first row is returned. Perhaps you're getting some lock contention?

Andy
--
Andy Hardy. PGP key available on request


Received on Thu Mar 16 2000 - 08:22:10 CST

Original text of this message

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