Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ORA-06550 wrong number or types of arguments when calling Oracle stored procedure

Have been fighting this for two days and am very frustrated but feel like I am making progress. After reviewing Oracle's online docs I am here. Receiving the following error upon code execution:

ORA-06550: line 1, column 15: PLS-00306: wrong number or types of arguments in call to 'P_SALTEDHASH' ORA-06550: line 1, column 7: PL/SQL: Statement ignored

Stored procedure looks like this:

PROCEDURE stored_procedure_name ( p_passwd            IN  VARCHAR2,
                          p_salt              IN  VARCHAR2,
                          p_saltedhash_passwd OUT VARCHAR2
                        )

My code:

        string stored_procedure_name = "stored_procedure_name";

        // create the command object
        OracleCommand cmd = conn.CreateCommand();
        cmd.Connection = conn;
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = stored_procedure_name;
        cmd.BindByName = true;

        //Oracle Parameters necessary for the p_saltedhash function          
        cmd.Parameters.Add("p_passwd", p_passwd);
        cmd.Parameters.Add("p_salt", p_salt);

        OracleParameter p_saltedhash_passwd = 
            new OracleParameter("p_saltedhash_passwd", OracleDbType.Varchar2);
        p_saltedhash_passwd.Direction = ParameterDirection.ReturnValue;
        cmd.Parameters.Add(p_saltedhash_passwd);



        // execute the pl/sql block
        cmd.ExecuteNonQuery();

        Response.Write("Pin hash is: " + p_saltedhash_passwd);`
like image 676
Geekender Avatar asked Nov 10 '11 19:11

Geekender


1 Answers

change

p_saltedhash_passwd.Direction = ParameterDirection.ReturnValue;

to

p_saltedhash_passwd.Direction = ParameterDirection.Output;
like image 167
Yahia Avatar answered Nov 15 '22 12:11

Yahia