example of using clause RETURNING

2001-05-21 Thread Hillman, Alex

Could somebody please provide an example of returning clause for update,
delete or insert SQL statement when there is an update, delete or insert of
multiple rows. I know how to do it if there is one row. 

Alex Hillman
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Hillman, Alex
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: example of using clause RETURNING

2001-05-21 Thread Jared Still


How about:

DECLARE
   TYPE NumList IS TABLE OF emp.empno%TYPE;
   enums NumList;
BEGIN
   DELETE FROM emp WHERE deptno = 20
  RETURNING empno BULK COLLECT INTO enums;
  -- if there were five employees in department 20,
  -- then enums contains five employee numbers
END;

Jared


On Monday 21 May 2001 15:35, Hillman, Alex wrote:
 Could somebody please provide an example of returning clause for update,
 delete or insert SQL statement when there is an update, delete or insert of
 multiple rows. I know how to do it if there is one row.

 Alex Hillman
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jared Still
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).