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: fetching across cursors

Re: fetching across cursors

From: Mark G <someone_at_hot>
Date: Tue, 13 Jul 1999 10:05:24 +0100
Message-ID: <378afefe.0@145.227.194.253>


There is nothing wrong with that code.
If you placed the commit inside of the loop however, you will get a fetch-out-of-sequence error message.

M

nooruddin wrote in message <7mg2c2$r6c$1_at_news.vsnl.net.in>...
>I've tried this on my server and its working
>
>here it is....
>
>declare
>
>cursor c1 is select * from emp for update;
>begin
>/* note the r does not have to be declared*/
>for r in c1 loop
>
>delete from emp where current of c1;
>
>end loop;
>
>commit;
>end;
>/
>
>I think this will work , Note that the commit is outside the loop because
>
>if given inside it might violate some locking mechanism and you might
>get errors like
>ora-1002 fetch out of sequence
>
>
>
>Doug Cowles wrote in message <377D856F.A47A4CB4_at_bigfoot.com>...
>>I know we've been through this topic recently but I think this is an
>>easy one.
>>Following code - just an opern cursor deleting it's own rows and
>>comitting,
>>works on Oracle 8.0.5 and gives a Fetch Out of Sequence on 7.3.3.
>>Does that make sense?
>>Does Oracle 8 allow this type of thing? And, is it against ANSI
>>standard?
>>
>>create table xyz (a NUMBER, b NUMBER)
>>alter table xyz add constraint tyz primary key (a);
>>(insert a handful of values)
>>begin
>>declare
>>cursor c0 as select * from xyz
>>begin
>>for v in c0
>> delete from xyz where a = v.a;
>> commit;
>>end loop;
>>end;
>>
>>Fetch out of sequence on 7.3.3 - Procedure complete on Oracle 8.0.5
>>(Things may be syntactically off a little bit, but you get the general
>>idea)
>>
>
>
Received on Tue Jul 13 1999 - 04:05:24 CDT

Original text of this message

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