I need to pass c# user defined object:

[DataContract]
public class SEmployeeIncome
{
    [DataMember]
    [OracleObjectMappingAttribute("CARDID")]
    public string CardId { get; set; }
    [DataMember]
    [OracleObjectMappingAttribute("INCOMETIME")]
    public string IncomeTime { get; set; }

}

as list to pl/sql function but oracle returns such error : {"Invalid parameter binding\r\nParameter name: p_employees_income"}

This is how i pass object list as parameter:

        var oracleParam = new OracleParameter();
        oracleParam.OracleDbType = OracleDbType.Array;
        oracleParam.Direction = ParameterDirection.Input;
        oracleParam.ParameterName = "p_employees_income";
        oracleParam.Size = entity.EmployeesIncome.Count();
        oracleParam.Value = entity.EmployeesIncome.ToArray() ;//SEmployeeIncome list

        oracleCommand.Parameters.Add(oracleParam);

and pl/sql function definition as:

Function search_delayed_employees (p_employees_income   employee_income ) 
return ics_types.result_cursor ; 
share|improve this question
    
It looks like you are trying to pass an array into a pl/sql function parameter that is accepting a single. Try passing ToArray().First() to see if it accepts that – Dominic Cotton Jan 5 at 16:53
up vote 0 down vote accepted

I've found answer for my question. Explanation of the answer: http://appsjack.blogspot.com/2010/09/pass-custom-udt-types-to-oracle-stored.html

share|improve this answer
    
That blog doesn't mention that there is a Visual Studio tool to create the C# classes. Here is a walkthough showing how to use UDTs that might also be helpful: oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/app‌​dev/… – Christian Shay Jan 11 at 6:02
    
Thanks Christian. This is a excellent tool. – Murad Garibzada Jan 11 at 6:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.