Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PL/SQL: reading and manipulating data from cursor with a restriction

445613Jul 27 2010 — edited Aug 2 2010
Hi all,

I have a requirement to read from a cursor into a record and then manipulate data in that record with some values supplied from a user, before outputting results. So normally I would create a database table, populate from a cursor and then apply the deletes / updates to this temporary table, output results and drop this table.

However I am restricted in that for various reasons we cannot easily create even temporary usage database tables at this client. Please leave aside the absurdity of this situation for now.

Is there a way that one can read data into record objects in PL/SQL (or an equivalent structure), and then insert and delete into that object ? If not how else might this be achieved ? Added via edit : we are PL/SQL Release 10.2.0.3.0

The code would be something comparable to :
DECLARE
   v_emprec    employees%ROWTYPE;

   CURSOR cur
   IS
      SELECT * FROM employees ;

BEGIN
   OPEN cur;

   LOOP
      FETCH cur INTO v_emprec;
      EXIT WHEN cur%NOTFOUND OR cur%ROWCOUNT > 5;
   END LOOP;

/* Apply manipulations to the  object selected into */
*DELETE FROM v_emprec WHERE ...*
END
Many thanks in advance for any ideas.

--LT

Edited by: lewist22 on Jul 27, 2010 3:24 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 30 2010
Added on Jul 27 2010
14 comments
2,017 views