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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:03:16+00:00 2026-05-22T23:03:16+00:00

My procedure is declare here : create or replace PACKAGE MYPKG IS PROCEDURE MYPROCEDURE(

  • 0

My procedure is declare here :

create or replace
PACKAGE MYPKG
IS
PROCEDURE MYPROCEDURE(
        sNom            IN VARCHAR2,
        sValeur         OUT VARCHAR2,
        sCommentaire    OUT VARCHAR2,
        sRetour         OUT VARCHAR2,
        sMsgRetour      OUT VARCHAR2);
END;

The execution is Ok with SQL Developer.

I try to execute this procedure in C# :

OracleCommand cmd = new OracleCommand("MYPKG.MYPROCEDURE", OraCon);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter name = new OracleParameter("sNom", OracleType.VarChar);
name.Value = "CG";
cmd.Parameters.Add(name);
OracleParameter valeur = new OracleParameter("sValeur", OracleType.VarChar);
cmd.Parameters.Add(valeur);
OracleParameter commentaire = new OracleParameter("sCommentaire", OracleType.VarChar);
cmd.Parameters.Add(commentaire);
OracleParameter retour = new OracleParameter("sRetour", OracleType.VarChar);
cmd.Parameters.Add(retour);
OracleParameter msgRetour = new OracleParameter("sMsgRetour", OracleType.VarChar);
cmd.Parameters.Add(msgRetour);

using (OracleDataReader row = cmd.ExecuteReader())
{
    while (row.Read())
    {
        Console.WriteLine(row.GetValue(0));
    }
}

I have the error “Wrong Parameter”.
How execute the PL/SQL procedure ?

  • 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-22T23:03:17+00:00Added an answer on May 22, 2026 at 11:03 pm

    This is how I would approach it.

    NOTE: I have compiled this code, but I have not tested it against a database, although I have lots of similar code that works fine.

    Also note: you are not getting back a collection, so you should really be using OraCmd.ExecuteNonQuery rather than OraCmd.ExecuteReader

    using System.Configuration;
    using System.Data;
    using Oracle.DataAccess.Client;
    
    
        namespace Testing
        {
            public class OracleCommandTest
            {
    
                string m_strConnectionsString = string.Empty;
    
                //Constructor
                public OracleCommandTest()
                {
                    //Get the connection string from the app.config            
                    m_strConnectionsString = ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString;
    
                    //if it is a web app, then use this call instead
                    //m_strConnectionsString = WebConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString;
    
                }
    
    
    
                public void getData(string sNom, out string sValeur, out string sCommentaire, out string sRetour, out string sMsgRetour)
                {
                    OracleConnection ora_conn = new OracleConnection(m_strConnectionsString);
    
                    try
                    {
                        ora_conn.Open();
    
                        /*********************Oracle Command**********************************************************************/
                        OracleCommand ora_cmd = new OracleCommand("MYPKG.MYPROCEDURE", ora_conn);
                        ora_cmd.BindByName = true;
                        ora_cmd.CommandType = CommandType.StoredProcedure;
    
    
                        ora_cmd.Parameters.Add("sNom", OracleDbType.Varchar2, sNom, ParameterDirection.Input);
                        ora_cmd.Parameters.Add("sValeur", OracleDbType.Varchar2, ParameterDirection.Output);
                        ora_cmd.Parameters.Add("sCommentaire", OracleDbType.Varchar2, ParameterDirection.Output);
                        ora_cmd.Parameters.Add("sRetour", OracleDbType.Varchar2, ParameterDirection.Output);
                        ora_cmd.Parameters.Add("sMsgRetour", OracleDbType.Varchar2, ParameterDirection.Output);
                        /*********************Oracle Command**********************************************************************/
    
                        ora_cmd.ExecuteNonQuery();
    
                        //Now get the values output by the stored procedure    
                        sValeur = ora_cmd.Parameters["sValeur"].Value.ToString();
                        sCommentaire = ora_cmd.Parameters["sCommentaire"].Value.ToString();
                        sRetour = ora_cmd.Parameters["sRetour"].Value.ToString();
                        sMsgRetour = ora_cmd.Parameters["sMsgRetour"].Value.ToString();
    
    
    
    
                    }
    
                    //catch (Exception ex)
                    //{
                    //    WebErrorHandling.WriteToEventLog("PRVEquipment_DAL.getPRVEquipment", ex);
    
                    //}
                    finally
                    {
                        if (ora_conn.State == ConnectionState.Open)
                        {
                            ora_conn.Close();
                        }
                    }
    
                }
    
    
            }
    
    
        }
    

    Hope this helps

    Harvey Sather

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

Sidebar

Related Questions

Here is the definition of the stored procedure: CREATE OR REPLACE PROCEDURE usp_dropTable(schema VARCHAR,
Here's the script: create procedure sp_DescuentoAlquiler as declare @IDAlquiler int, @NumeroPelicula int, @MontoTotal float
Sample Query: CREATE PROCEDURE dbo.Test (@p varchar(10)) AS DECLARE @param varchar(10) SET @param =
My stored procedure is called as below from an SQL instegartion package within SQL
hey guys,i'm new to mysql.here i wrote a procedure that error occured: DELIMITER $$
I have a stored procedure as follows create procedure [dbo].[PriceConfirm] @quote float, @membershipType int,
i'm quite new to postgres. i want to create a function (like stored procedure)
I'm attempting to create a procedure in Oracle Express Server (Application Express 2.1.0.00.39) using
I'm stuck here. I've got a Procedure that I want to run X* times
I Have created a procedure which is: CREATE PROCEDURE test.table_creation ( @ID INT )

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.