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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:14:22+00:00 2026-06-07T22:14:22+00:00

I’m trying to execute the following stored procedure in .net 4.5 PROCEDURE my_procedure (

  • 0

I’m trying to execute the following stored procedure in .net 4.5

 PROCEDURE my_procedure ( 
      a_cursor          OUT t_cursor,
      return_value      OUT VARCHAR2,
      a_type                VARCHAR2,
      a_time                DATE,
      a_id                  VARCHAR2,
      a_arg1                VARCHAR2,
      a_from                VARCHAR2,
      a_gl2                 VARCHAR2,
      a_arg2                DATE DEFAULT NULL,
      a_templ               VARCHAR2 DEFAULT NULL 
      )

Most of these arguments can be null. In toad I can execute it with:

BEGIN package.my_procedure( :c, :out, 'arg', '', '123' , '', '', '', '', ''); END;

In C# I’m trying the following:

object[] parameters = {
         new OracleParameter("arg1", arg1),
         new OracleParameter("arg", "arg"),
         new OracleParameter("empti", ""),
         new OracleParameter("out", OracleDbType.Varchar2, ParameterDirection.Output),
         new OracleParameter("c", OracleDbType.RefCursor, ParameterDirection.Output)
                                      };

     const string sql = "BEGIN package.my_procedure  
          (:c, :out, :arg, :empti, :arg1 , :empti, :empti, :empti, :empti, :empti); END;";
     res = _projectRepository.ExecuteStoredProcedure(sql, parameters);

And I get the following error

Test method Tests.repository.RepositoryTests.TestMethod1 threw exception: 
Oracle.DataAccess.Client.OracleException: ORA-06550: 
line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'my_procedure'ORA-06550: 
line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'my_procedure'ORA-06550: 
line 1, column 7:
PL/SQL: Statement ignored

I’ve tried with and without the optional parameters and with/without the return_value/:out parameter.

I am using the Oracle.DataAccess provider v. 4.112.3.0. It works with other stored procedures that does not have that many parameters / only one out parameter (cursor).

EDIT: I found one error, i need to have the output parameters first in the parameter array;

new OracleParameter("c", OracleDbType.RefCursor, ParameterDirection.Output),
                    new OracleParameter("out", OracleDbType.Varchar2, ParameterDirection.Output),
                    new OracleParameter("arg1", "arg1"),
                    new OracleParameter("empti", ""),
                    new OracleParameter("arg", arg),
                                      };

Now i am getting the error:

ORA-06502: PL/SQL: numeric or value error: character string buffer too small

seems like a database error, but looks strange since i can execute the same command from toad without getting the error.

  • 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-07T22:14:25+00:00Added an answer on June 7, 2026 at 10:14 pm

    When using VARCHAR2 as an OUPUT you need to provide the size of the character buffer. The constructor overloads won’t help here though, you’ll need to create the variable by hand to set the required properties.

    // Specify a size adequate for the full return value.
    OracleParameter returnValue =
      new OracleParameter("return_value", OracleDbType.Varchar2, 100);
    returnValue.ParameterDirection = ParameterDirection.Output;
    
    object[] parameters = {
      returnValue,
      // other parameters here
    };
    

    Original

    I’ll leave the original answer in tact, as it took care of the first version of the question.

    The error provided is correct, you’re not providing the right number of parameters in your call. Let’s look at the original working code that Toad for Oracle can use and map them to the parameter names:

    BEGIN
      package.my_procedure(a_cursor     => :c,
                           return_value => :out,
                           a_type       => 'arg',
                           a_time       => '',
                           a_id         => '123',
                           a_arg1       => '',
                           a_from       => '',
                           a_gl2        => '',
                           a_arg2       => '',  -- DEFAULT NULL
                           a_temp1      => ''); -- DEFAULT NULL
    END;
    

    Notice that in Toad for Oracle you’re even providing values for the parameters declared as DEFAULT NULL (which isn’t a problem).

    If you look at your parameter list you’ll see that you’re providing bindings for arg1, arg, empti, out, and p. You position these to match up as follows:

    a_cursor     => :c     -- you created the OracleParameter as 'p', not 'c'
    return_value => :out  
    a_type       => :arg
    a_time       => :empti
    a_id         => :arg1
    a_arg1       => :empti
    a_from       => :empti
    a_gl2        => :empti
    a_arg2       => :empti
    a_temp1      => :empti
    

    Oracle is complaining that the number of parameters didn’t match, and that’s because you’re declaring your reference cursor parameter as p and not as c. You need to either update the OracleParamter to the name of c or change the PL/SQL being executed to :p for the first parameter.

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I know there's a lot of other questions out there that deal with this

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.