Call a Oracle function in .net c# with the Enterprise Library Application Block

we got the following function: fnc_get_package_version in the package: PCK_MY_APPLICATION

here is the code to call that function from c# with the Enterprise Library Application Block.

string returnValue = "";
 Database database = this.GetDatabase();

 DbCommand dbCommand = 
    database.GetStoredProcCommand("PCK_MY_APPLICATION.fnc_get_package_version");

 OracleParameter returnParam = new OracleParameter("return", OracleType.VarChar);
 returnParam.Size = 10;
 returnParam.Direction = ParameterDirection.ReturnValue;
 dbCommand.Parameters.Add(returnParam);

 int affected = database.ExecuteNonQuery(dbCommand);
 Debug.WriteLine(
   "affected rows: " + affected + "   returnParam.Value: " + returnParam.Value);

 returnValue = returnParam.Value.ToString();
 dbCommand.Dispose();

 return returnValue;

No comments:

Post a Comment

Latest Posts

Popular Posts