Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:13:47+00:00 2026-06-15T19:13:47+00:00

I have package in which I have declared cursor. And I want to return

  • 0

I have package in which I have declared cursor. And I want to return that cursor as OUT variable of PROCEDURE.
I can’t just get data from that cursor cause data needs to be loaded first by load_data proc.
I wan’t to use that MMM_CURSOR cause there’s additional functionality, which uses that same select – writing to files at DB level.

create or replace PACKAGE BODY PCG_MMM AS

CURSOR MMM_CURSOR(OFFSET NUMBER) IS 
SELECT TYPE, VALUE FROM MMM_TEMP_LOGS WHERE VALUE = OFFSET;

TYPE RET_TYPE IS REF CURSOR;

PROCEDURE LOAD_DATA AS 
-- loading data into MMM_TEMP_LOGS--
END LOAD_DATA;

PROCDURE WRITE_TO_FILE AS
BEGIN
-- writing to file here --
END WRITE_TO_FILE;

PROCEDURE GET_DATA(DATA RET_TYPE, OFFSET NUMBER:=0) AS
BEGIN
   LOAD_DATA;

   DATA := MMM_CURSOR(OFFSET) ; <--- ??

END GET_DATA;

END PCG_MMM;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:13:48+00:00Added an answer on June 15, 2026 at 7:13 pm

    you can’t pass a CURSOR out of a procedure, but you can pass a ref cursor. you also can’t just convert a cursor to a ref cursor.

    so if you want to use that cursor in a few places + have the ability to pass it out, then i’d recommend you change it to a view, and use that in lieu of a cursor.

    eg

    create view MMM_VIEW
    as
    SELECT TYPE, VALUE FROM MMM_TEMP_LOGS;
    

    (if you were passing in variables within it and need to keep it that way for performance, look up “parameterised views”)

    create or replace PACKAGE BODY PCG_MMM AS
    
    TYPE RET_TYPE IS REF CURSOR;
    
    PROCEDURE LOAD_DATA AS 
    -- loading data into MMM_TEMP_LOGS--
      for r_cur in (select * from mmm_view) loop...or whatever (replace the cursor with the view)
    END LOAD_DATA;
    
    PROCDURE WRITE_TO_FILE AS
    BEGIN
    -- writing to file here --
    END WRITE_TO_FILE;
    
    PROCEDURE GET_DATA(DATA out RET_TYPE, OFFSET NUMBER:=0) AS
    BEGIN
       LOAD_DATA;
    
       open DATA for select * From mmm_view where value = OFFSET;
    
    END GET_DATA;
    
    END PCG_MMM;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a java class which is package-private (declared with class, not public
I have simple SSIS package which reads data from flat file and insert into
I have written a PL/SQL (Ora10gR2) package which contains a stored procedure. The header
I have two classes in same package. i have declared a static variable in
How can we find all the variables in the package, that are not declared
I have an SSIS package which reads an Excel File (Data Flow Source) and
i have an ssis Package which runs on business days (mon-Fri). if i receive
I have simple SSIS package in which On Error event handler I have created
I have a relatively big SSIS package which I'm trying to edit. I basically
I have written an Apex class in a Salesforce managed package which uses the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.