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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:06:02+00:00 2026-06-06T11:06:02+00:00

I would be calling procedure or function from java using JDBC . In terms

  • 0

I would be calling procedure or function from java using JDBC.

In terms of best practice and performance, it is better to use a function which returns a SYS_REFCURSOR or use a procedure which returns a SYS_REFCURSOR.

Eg.

Procedure

create or replace procedure my_proc(p_deptno IN number,p_emp_no IN varchar2
    , p_cursor OUT SYS_REFCURSOR)
    is
    begin
    open p_cursor FOR
    select *
    from emp
    where deptno = p_deptno and emp_number=p_emp_no;
    end proc;
    /


Function

CREATE OR REPLACE FUNCTION my_func (p_deptno IN number,p_emp_no IN varchar2)
   RETURN SYS_REFCURSOR
AS
   p_cursor   SYS_REFCURSOR;
BEGIN
   OPEN p_cursor FOR
      select *
        from emp
        where deptno = p_deptno and emp_number=p_emp_no;
   RETURN p_cursor;
END;
/

Which one of the above is a better option? Could someone provide some insight into this?
Any help is highly appreciable.

Thanks

  • 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-06T11:06:04+00:00Added an answer on June 6, 2026 at 11:06 am

    From a performance standpoint, it doesn’t matter.

    In general, if the intent of a PL/SQL block is to return something to the caller, it should be in a function. If the intent of a PL/SQL block is to do something (deletes, inserts, updates, etc.), it should be in a procedure. Since the intent of this code is to return something to the caller, it would be appropriate for it to be a function.

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

Sidebar

Related Questions

I am calling an API from a Rails model and I would like to
I would like to use the data you get when calling the following URL
Aim: Calling a very slow stored procedure (with parameters) asynchronously from code behind of
When writing a Delphi procedure or function in assembly code, which registers must be
I am trying to create a generic method for calling stored procedures I would
Would there be any problems calling an HTTPS page (e.g. a credit card authorisation
I would like to know if after calling functions the data I have in
How would you go about invoking the ActionFilterAttribute when you are calling a controllers
I would like my video t0 start full screen, I'm calling the following method
I thought that calling BeginInvoke more than once on the same delegate instance would

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.