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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:21:55+00:00 2026-05-16T11:21:55+00:00

From Oracle : When you declare a cursor variable as the formal parameter of

  • 0

From Oracle:
“When you declare a cursor variable as the formal parameter of a subprogram that fetches from the cursor variable, you must specify the IN or IN OUT mode. If the subprogram also opens the cursor variable, you must specify the IN OUT mode.”

But, I can code that (only OUT parameter):

create or replace procedure mycur_out(mc OUT mycurpkg.mytypecur)  as 
begin
    open mc for select * from mytable; 
end mycur_out;

and works equal to (IN OUT parameter)

create or replace procedure mycur_inout(mc IN OUT mycurpkg.mytypecur) 
as
begin
    open mc for select * from table10;
end mycur_inout;

Also, It’s work fine with dynamic cursor too:

create or replace procedure mycur_out_ref(mc out mycurpkg.mytyperefcur) 
as
begin
    open mc for 'select * from table10';
end mycur_out_ref;

I’ve tested the 3 cases directly from oracle and from VB6 with ADO, and no problems.
So, in that cases, is there any difference between IN using just “OUT” and “IN OUT” cursors parameters?

UPDATE
The reason I’m asking:

  • We read data using routines similar
    to the examples (just open the
    cursors). The cursor parameters
    always are “IN OUT” (Don’t ask me
    why, I’m trying to figure out)
  • The routines are invoked with ADO/VB6
  • Now, we are trying to use some of the routines from JDBC, but the
    adapter apparently just accepts OUT
    parameters in this cases.
  • Finally, the main reason, I want to change the cursor parameters on DB
    routines to only OUT, but first I
    want to know the collaterals effects
    of that change.

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-05-16T11:21:56+00:00Added an answer on May 16, 2026 at 11:21 am

    In the text you quote from the manual, note that it is specifically talking about “a subprogram that fetches from the cursor variable“. None of your examples do this, so the quote is not relevant to them.

    However, it nonetheless appears that there’s nothing wrong with using OUT only in such a situation, if the subprogram both opens and fetches from the cursor variable:

    SQL> variable c refcursor
    
    SQL> set serveroutput on
    SQL> create or replace procedure no_good (c  OUT sys_refcursor)
      2     as
      3        my_dummy  dual.dummy%type;
      4     begin
      5       open c for select dummy from dual union all select dummy from dual;
      6       fetch  c into my_dummy;
      7       dbms_output.put_line( my_dummy );
      8     end;
      9  /
    
    Procedure created.
    
    SQL> exec no_good( :c )
    X
    
    PL/SQL procedure successfully completed.
    
    SQL> print c
    
    D
    -
    X
    

    I think the the text is actually trying to make two points that are somewhat independent of each other. Firstly, if you want to pass any already-opened cursor variable into a subprogram, which will fetch from it, the parameter must be declare IN or IN OUT. Secondly, if you want to pass a cursor variable into a subprogram, which will then open it, the parameter must be declared OUT or IN OUT. This is true regardless of whether you actually care about passing the value of the cursor variable back to the caller:

    SQL> create or replace procedure no_good (c  IN sys_refcursor)
      2     as
      3        my_dummy  dual.dummy%type;
      4     begin
      5       open c for select dummy from dual;
      6       fetch  c into my_dummy;
      7       dbms_output.put_line( my_dummy );
      8       close c;
      9     end;
     10  /
    
    Warning: Procedure created with compilation errors.
    
    SQL> show error
    Errors for PROCEDURE NO_GOOD:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    5/6      PL/SQL: SQL Statement ignored
    5/11     PLS-00361: IN cursor 'C' cannot be OPEN'ed
    

    This error can be fixed by changing the parameter mode, but actually it would seem to make more sense to simply make the cursor variable a local variable rather than a parameter.

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

Sidebar

Ask A Question

Stats

  • Questions 523k
  • Answers 523k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The most straight-forward thing to do here would be to… May 16, 2026 at 9:31 pm
  • Editorial Team
    Editorial Team added an answer Update: If your DataTable itself is called "Sales.SalesContact", you could… May 16, 2026 at 9:31 pm
  • Editorial Team
    Editorial Team added an answer You can use negative matches or request.user_agent =~ /Mobile|webOS/ &&… May 16, 2026 at 9:31 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

In Oracle I can declare a reference cursor... TYPE t_spool IS REF CURSOR RETURN
How to get the dynamic select results of EXECUTE within PL/SQL from Oracle sqlplus
I'm sorting out a series of SQL scripts for my company written in Oracle
when using oracle forms to generate md5 hash, i get result that is different
As Oracle sues Google over the Dalvik VM it becomes clear, that you cannot
From here, Oracle ASM provides several advantages over conventional file systems and storage managers,
Which would be a better option for bulk insert into an Oracle database ?
I am new to Oracle PL/SQL and am having some difficulty conceptualizing collections with
I've a table in an Oracle (10g XE) database, and I'm going to clean
Quick question about cursors (in particular Oracle cursors). Let's say I have a table

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.