【问题标题】:ORA-06550 wrong number or types of arguments when calling Oracle stored procedureORA-06550 调用 Oracle 存储过程时参数的数量或类型错误
【发布时间】:2011-12-26 11:38:29
【问题描述】:

已经为此奋斗了两天,非常沮丧,但感觉自己正在取得进步。在查看了 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);`

【问题讨论】:

  • 为前 2 个参数指定 OracleDbType.Varchar2 似乎是个好主意。我怀疑这是默认设置,不相信自动转换。
  • 此代码有效,但如何输入 p_passwd 和 p_salt 的值?现在输出实际上是“盐舔哈希:p_saltedhash_passwd”

标签: c# asp.net .net oracle ora-06550


【解决方案1】:

改变

p_saltedhash_passwd.Direction = ParameterDirection.ReturnValue;

p_saltedhash_passwd.Direction = ParameterDirection.Output;

【讨论】:

  • 试过但收到 ORA-06502: PL/SQL: numeric or value error: string buffer too small ORA-06512: at "SOME_FUNCTION_I_DON'T_RECOGNIZE", line 77 ORA-06512: at "SOME_FUNCTION_I_DON “T_RECOGNIZE”,第 130 行 ORA-06512:第 1 行
  • @Geekender 我对您用来帮助那里的过程/功能知之甚少……据我所知,您正在使用 MS 官方弃用的 OracleClient,您应该考虑更改。
  • 我确实更改了这一行 OracleParameter p_saltedhash_passwd = new OracleParameter("p_saltedhash_passwd", OracleDbType.Varchar2, 2000); 并且它有点工作。现在它正在打印一些东西而不是数据。我正在使用 Oracle 的 Oracle.DataAccess.Client。
  • @Geekender 打印输出参数p_saltedhash_passwd 在对Response.Write 的调用中使用p_saltedhash_passwd.Value.ToString()
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-26
  • 2021-11-30
  • 1970-01-01
  • 2012-07-10
  • 2018-06-12
相关资源
最近更新 更多