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!

Cursor For Loop and Ref Cursor

RM33Jun 4 2020 — edited Jun 5 2020

I am using 11g

So my ultimate goal is to create a ref cursor so that I can create a Crystal Report off the ref cursor.

I am using a Cursor For Loop. It looks something like this. Note this is a simplified version of what I am doing.

BEGIN
  FOR  x  IN (SELECT Customer_ID FROM Customer_Table)
  LOOP
     v_ID :=  x.Customer_ID;
     v_Total_Bill := fn_Bill_Function(x.Customer_ID);
     v_Date_Due := fn_Date_Due_Function(x.Customer_ID);

     Need to save row after row here.

  END LOOP;
END;

So basically I need to store row after as I hit each customer ID. Do my calculations then go on to the next ID. Problem is that the DBA will not create a table for me. So put the results someplace and create a ref_cursor off it. How can I do the above?

Thanking you all in advance.

Comments
Post Details
Added on Jun 4 2020
3 comments
556 views