Re: PL/SQL CURSOR DELETES

From: fumi <fumi__at_tpts5.seed.net.tw>
Date: 26 Jan 1999 12:46:46 GMT
Message-ID: <78kdfm$jf0$3_at_news.seed.net.tw>


Paul Dudas ¼¶¼g©ó¤å³¹ <36AB8708.6B33_at_neca.com>...
>Can deletes be done through Cursor Control? I can do updates
>succesfully but cannot quite get the code syntax to do a delete to work.
>My cursor would select a series of records thru a select and I would
>want to fetch and delete each 1 of them in a loop. Is this normally how
>it is done ? Thanks for your help.

Yes, It can. The following is done in Oracle 8.0.3:

SQL> declare
  2 cursor c1 is select * from emp where empno>7500 for update;   3 begin
  4 for r1 in c1 loop
  5 delete from emp where current of c1;   6 end loop;
  7 end;
  8 /

PL/SQL procedure successfully completed.

SQL>
SQL> select empno from emp;

    EMPNO


     7369
     7499
Received on Tue Jan 26 1999 - 13:46:46 CET

Original text of this message