Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: cursor/update freezes
Looks like an infinite loop does it not?
I don't see any break procedure and AFAIK the only thing allowed whenever is
a procedure or a label, no other keywords.
Personally, I would strongly recommend you to always trap the notfound
condition (in sqlca.sqlerrd[3]) explicitly. For me this is an example of bad
programming.
Also, actually you write
exec sql update sys.bp_deco set amount = 10;
as you don't do anything with the amounts you fetch.
Thirdly (sorry for criticizing you) you should NEVER EVER create your own
tables using SYS.
Regards,
Sybrand Bakker, Oracle DBA
Thomas Sjoerdsma <t_sjoerdsma_at_hotmail.com> wrote in message
news:953211533.174983_at_newsreader2.wirehub.nl...
> 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;
>
>
>
Received on Thu Mar 16 2000 - 07:15:39 CST
![]() |
![]() |