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 6067099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:34:18+00:00 2026-05-23T09:34:18+00:00

When using stored procedure is it faster to return a cursor back? or is

  • 0

When using stored procedure is it faster to return a cursor back? or is it faster to use the out data parameter of the data type.
or it really won’t have any performance difference.

PROCEDURE SPUSINGCURSOR ( input1 INT,
                          retcursor out sys_refcursor ) IS
BEGIN

  OPEN retcursor FOR
    SELECT var1,
           var2,
           var3
      FROM Table_Vlaues
     WHERE var1 = input1
  ORDER BY var1;

END;
  • 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-05-23T09:34:19+00:00Added an answer on May 23, 2026 at 9:34 am

    It depends, on lots of things.

    If you execute the query within the SP and return a nested table type containing the results, the SP will take time to run and consume memory required to hold the data. It will also need to send all that data back to the client in one go, which will take some time. But if you need to access all the data before going on to do anything else, and the memory requirement is not too large, this is a reasonable way to do things.

    If you instead open and return a REF CURSOR, the actual SP execution time and the memory required will be less; but you are just deferring the execution time to later, when you fetch from the cursor. If there is a good chance you won’t need to fetch all the rows; or if the data set is likely to be very large; or if fetching rows in small batches allows you to do some other meaningful work in-between (such as pipe them to another thread or process that will actually do something with them), then this might be a superior way to go. The main downside of returning a cursor is that fetching from it is then likely to require more network round-trips which could be slower overall than just returning the data all at once.

    A non-performance advantage of returning an open REF CURSOR is that it is easier to work with in some client environments (e.g. in JDBC it maps directly to a ResultSet, whereas for a nested table type you need to do extra work to provide Java with the type information).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just created a report in Report Manager using a Stored Procedure which
In asp.net(C#) i want to fetch data from a database using a stored procedure
How can I retrieve the return value of a stored procedure using iBatis.NET? The
I have a stored procedure that returns a varchar(160) as an output parameter of
I have this stored procedure which I am using to populate a user table.
I am using a stored procedure to insert data into a temp table using
I am using IDataReader to get the data from db using stored procedure. ie
I'm trying to return 'ItemId' column value of 'item' table using stored procedure based
I'm using stored procedure to fetch data and i needed to filter dynamically. For
Using stored procedure output for a parameter of a function DECLARE @SeqNo int; DECLARE

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.