EXPLAIN EXTENDED

How to create fast database queries

Archive for May 13th, 2009

Oracle: returning deleted records

Comments enabled. I *really* need your comment

From Stack Overflow:

I need to return a rowset from an Oracle procedure, and then delete them in that same procedure.

Is there a neat way of doing this without temp tables?

Something like an in-memory cursor maybe?

Oracle has a nice feature of returning cursor variables from a stored procedure or an anonymous block.

As any cursor, the returned cursor is a handle to a stable rowset.

This means that it's not affected by any changes to database that were made after the cursor was open.

We can exploit this feature to achieve the required behavior.

Let's create a sample table:
Read the rest of this entry »

Written by Quassnoi

May 13th, 2009 at 11:00 pm

Posted in Oracle