Re: SELECTing from a DML statement

From: Serge Rielau <>
Date: Fri, 04 Jul 2008 09:44:18 -0400
Message-ID: <>

jefftyzzer wrote:
> DB2 allows one to select from an insert, update, or delete, e.g.:
> select * from old table (delete from x where y = 1);
> --OR--
> select * from new table (update x set y = 1 where z = 2);
> --OR--
> select * from final table (insert into x (c1) values (1));
> Is there any equivalent in Oracle?


Oracle supports a clause after the UPDATE/DELETE/INSERT statement called RETURN INTO (or RETURNING??). Somewhat similar to the OUTPUT clause of SQL Server.
It may be sufficient for what you want to do. If you operate on more than one row then you'd typically dump the result into an associative array of rows in PL/SQL and use FORALL, etc for further processing.


Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Received on Fri Jul 04 2008 - 08:44:18 CDT

Original text of this message