4

Output parameter not return from stored procedure.

 2 years ago
source link: https://www.codeproject.com/Questions/5318111/Output-parameter-not-return-from-stored-procedure
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Copy Code
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


What I have tried:
Copy Code
--Stored Procedure
Create or Replace Procedure POC_Test(p_message Out Varchar2)
As
Begin
	p_Message := 'XYZ'; 
End POC_Test;
Copy Code
//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(); 
	connection.Open();

	cmd.CommandText="POC_Test";
	cmd.CommandType=CommandType.StoredProcedure;
	cmd.Parameters.Add("p_message", OracleDbType.Varchar2, "", ParameterDirection.Output);
	
	OracleDataAdaptor da= new OracleDataAdaptor();
	da.SelectCommand=cmd;
	
	DataTable dt= new DataTable();
	da.Fill(dt);
	connection.Close();
	
  }
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK