5

已经为此奋斗了两天,非常沮丧,但感觉自己正在取得进步。在查看了 Oracle 的在线文档后,我来到了这里。执行代码时收到以下错误:

ORA-06550:第 1 行,第 15 列:PLS-00306:调用“P_SALTEDHASH”时参数的数量或类型错误 ORA-06550:第 1 行,第 7 列:PL/SQL:语句被忽略

存储过程如下所示:

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

我的代码:

        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);`
4

1 回答 1

5

改变

p_saltedhash_passwd.Direction = ParameterDirection.ReturnValue;

p_saltedhash_passwd.Direction = ParameterDirection.Output;
于 2011-11-10T19:44:41.933 回答