Sushant Bagul

Sushant Bagul

  • 2.1k
  • 16
  • 2.2k

Getting error on output parameter.

Nov 20 2021 6:22 AM

I have done POC on Visual Studio 2017 .Net Framework 4.5.2 with DB Oracle 19c (Version 19.3) as ODP.Net we have used dll named as Oracle.DataAccess.Client.

Getting below error at C# side

ORA-06502 : PL/SQL: Numeric or Value error : Character string buffer too small.

Stored Procedure

Create or Replace Procedure POC_Test(p_message Out Varchar2)
    p_Message := 'XYZ'; 
End POC_Test;

//C# Code

using System;
Using Oracle.DataAcess.Client;

class DataBasePOC {
  static void Main() 
    OracleConnection connection = new OracleConnection("DataSource=POC_Database;User Id=User1;Password=PQR123");
    OracleCommand cmd=new OracleCommand(); 
    cmd.Parameters.Add("p_message", OracleDbType.Varchar2, "", ParameterDirection.Output);  
    OracleDataAdaptor da= new OracleDataAdaptor();
    DataTable dt= new DataTable();


Answers (2)