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: Returning clause in Delete

Re: Returning clause in Delete

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Wed, 8 Dec 1999 14:46:03 -0000
Message-ID: <944664485.18472.0.nnrp-01.9e984b29@news.demon.co.uk>

You need to use BULK COLLECT

begin

    delete
    from bet
    where geb < 80
    returning betform BULK COLLECT into bind;

 FOR i IN 1..bind.count LOOP

      dbms_output.put_line(bind(i));
 END LOOP;
end;

--

Jonathan Lewis
Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk

  1. Jensen wrote in message ...
    >Hi
    >
    >I have a PLSQL-block in which I delete records from a table. I would like
    to
    >log the IDs of the deleted records, so I thought using the RETURNING-clause
    >would do the trick.
    >But I don't understand how to return more than one record.
    >
    >declare
    > TYPE t_bind IS TABLE OF bet.betform%TYPE
    > INDEX BY BINARY_INTEGER;
    > bind t_bind;
    >begin
    > delete
    > from bet
    > where geb < 80
    > returning betform into bind;
    > FOR i IN 1..bind.count LOOP
    > dbms_output.put_line(bind(i));
    > END LOOP;
    >end;
Received on Wed Dec 08 1999 - 08:46:03 CST

Original text of this message

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