How can i call a stored procedure Oracle In Entity framework6

BITAR Yoan 0 Reputation points
2023-01-27T14:37:29.33+00:00

I have a proc in oracle that return somme parameters and one of this parameter is a record of table

in sql developper

declare
  -- Non-scalar parameters require additional processing 
  p_tab_charge_account PKG_VCR_TOOLS_TSI.TYP_TAB_CHARGE_ACCOUNT_DATA;
begin
  -- Call the procedure
  PKG_VCR_TOOLS_TSI.GET_LINE_ACCOUNT_DATA(p_partner_group_uid => :p_partner_group_uid,
                                          p_charge_code => :p_charge_code,
                                          p_tab_charge_account => p_tab_charge_account,
                                          p_returnStatus => :p_returnStatus,
                                          p_errorMessage => :p_errorMessage);
end;

in my code c#


var parameterAgent = new OracleParameter("p_partner_group_uid", OracleDbType.Single, agentId, ParameterDirection.Input);

var parameterCharge = new OracleParameter("p_charge_code", OracleDbType.Varchar2, chargeCode, ParameterDirection.Input);

var parameterReturnStatus = new OracleParameter("p_returnStatus", OracleDbType.Single, ParameterDirection.Output);

var parameterErrorMessage = new OracleParameter("p_errorMessage", OracleDbType.Varchar2, ParameterDirection.Output);
				
var parameterTabRecord = new OracleParameter("p_tab_charge_account", OracleDbType.Raw, ParameterDirection.Output);
				
				string sql = $"declare p_tab_charge_account PKG_VCR_TOOLS_TSI.TYP_TAB_CHARGE_ACCOUNT_DATA; BEGIN PKG_VCR_TOOLS_TSI.GET_LINE_ACCOUNT_DATA(:p_partner_group_uid,:p_charge_code,:p_returnStatus,:p_errorMessage); END;";
				
// call the PS
				var accounts = await _dbContext.Database
                                               .ExecuteSqlCommandAsync(sql, parameterAgent, parameterCharge,parameterTabRecord,parameterReturnStatus, parameterErrorMessage);

how could i call the procedure in my code c# knowing that the parameter ptabcharge_accunt is of type Tablee of record (internal type in Oracle)

My code raise an exception the parameter p_tab_account is not attached

which the solution for this

thanks in advance

Developer technologies | .NET | Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.