Re: SELECTing from a DML statement
From: Serge Rielau <srielau_at_ca.ibm.com>
Date: Fri, 04 Jul 2008 09:44:18 -0400
Message-ID: <6d6npjF14t9uU1@mid.individual.net>
Date: Fri, 04 Jul 2008 09:44:18 -0400
Message-ID: <6d6npjF14t9uU1@mid.individual.net>
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?
Jeff,
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.
Cheers
Serge
-- Serge Rielau DB2 Solutions Development IBM Toronto LabReceived on Fri Jul 04 2008 - 08:44:18 CDT