<small id='VISrh'></small><noframes id='VISrh'>

<legend id='VISrh'><style id='VISrh'><dir id='VISrh'><q id='VISrh'></q></dir></style></legend>
  • <i id='VISrh'><tr id='VISrh'><dt id='VISrh'><q id='VISrh'><span id='VISrh'><b id='VISrh'><form id='VISrh'><ins id='VISrh'></ins><ul id='VISrh'></ul><sub id='VISrh'></sub></form><legend id='VISrh'></legend><bdo id='VISrh'><pre id='VISrh'><center id='VISrh'></center></pre></bdo></b><th id='VISrh'></th></span></q></dt></tr></i><div id='VISrh'><tfoot id='VISrh'></tfoot><dl id='VISrh'><fieldset id='VISrh'></fieldset></dl></div>

      <bdo id='VISrh'></bdo><ul id='VISrh'></ul>
    <tfoot id='VISrh'></tfoot>
      1. Oracle“ORA-01008:并非所有变量都绑定"带参数的错误

        时间:2023-11-03
        <i id='vfbcL'><tr id='vfbcL'><dt id='vfbcL'><q id='vfbcL'><span id='vfbcL'><b id='vfbcL'><form id='vfbcL'><ins id='vfbcL'></ins><ul id='vfbcL'></ul><sub id='vfbcL'></sub></form><legend id='vfbcL'></legend><bdo id='vfbcL'><pre id='vfbcL'><center id='vfbcL'></center></pre></bdo></b><th id='vfbcL'></th></span></q></dt></tr></i><div id='vfbcL'><tfoot id='vfbcL'></tfoot><dl id='vfbcL'><fieldset id='vfbcL'></fieldset></dl></div>

        • <small id='vfbcL'></small><noframes id='vfbcL'>

            <bdo id='vfbcL'></bdo><ul id='vfbcL'></ul>

                <tbody id='vfbcL'></tbody>
            1. <legend id='vfbcL'><style id='vfbcL'><dir id='vfbcL'><q id='vfbcL'></q></dir></style></legend>

                • <tfoot id='vfbcL'></tfoot>
                  本文介绍了Oracle“ORA-01008:并非所有变量都绑定"带参数的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这是我第一次与 Oracle 打交道,我很难理解为什么会收到此错误.

                  This is the first time I've dealt with Oracle, and I'm having a hard time understanding why I'm receiving this error.

                  我在查询的 where 子句中使用带有 C# 的 Oracle 的 ODT.NET 和以下代码:

                  I'm using Oracle's ODT.NET w/ C# with the following code in a query's where clause:

                  WHERE table.Variable1 = :VarA
                    AND (:VarB IS NULL OR table.Variable2 LIKE '%' || :VarB || '%')
                    AND (:VarC IS NULL OR table.Variable3 LIKE :VarC || '%')
                  

                  我正在添加参数值,如下所示:

                  and I'm adding the parameter values like so:

                  cmd.Parameters.Add("VarA", "24");
                  cmd.Parameters.Add("VarB", "test");
                  cmd.Parameters.Add("VarC", "1234");
                  

                  当我运行这个查询时,服务器返回:

                  When I run this query, the server returns:

                  ORA-01008: not all variables bound 
                  

                  如果我注释掉任何一个AND(...."行,查询就会成功完成.

                  If I comment out either of the 'AND (....' lines, the query completes successfully.

                  如果我只用两个参数查询,而不用三个参数查询,为什么查询会正常运行?我收到的错误甚至没有意义

                  Why would the query run through alright if I'm only querying with two parameters, but not with three? The error I'm receiving doesn't even make sense

                  推荐答案

                  oracle 的 ODP.Net 提供程序默认使用按位置绑定.将行为更改为按名称绑定.将属性 BindByName 设置为 true.比你可以忽略参数的双重定义.

                  The ODP.Net provider from oracle uses bind by position as default. To change the behavior to bind by name. Set property BindByName to true. Than you can dismiss the double definition of parameters.

                  using(OracleCommand cmd = con.CreateCommand()) {
                      ...
                      cmd.BindByName = true;
                      ...
                  }
                  

                  这篇关于Oracle“ORA-01008:并非所有变量都绑定"带参数的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Oracle SQL:在带有 Select 语句的插入中使用序列 下一篇:ORACLE/SQL Server 中的减法与除外差异

                  相关文章

                  <small id='leQJo'></small><noframes id='leQJo'>

                    <legend id='leQJo'><style id='leQJo'><dir id='leQJo'><q id='leQJo'></q></dir></style></legend>
                    <tfoot id='leQJo'></tfoot>

                      • <bdo id='leQJo'></bdo><ul id='leQJo'></ul>
                    1. <i id='leQJo'><tr id='leQJo'><dt id='leQJo'><q id='leQJo'><span id='leQJo'><b id='leQJo'><form id='leQJo'><ins id='leQJo'></ins><ul id='leQJo'></ul><sub id='leQJo'></sub></form><legend id='leQJo'></legend><bdo id='leQJo'><pre id='leQJo'><center id='leQJo'></center></pre></bdo></b><th id='leQJo'></th></span></q></dt></tr></i><div id='leQJo'><tfoot id='leQJo'></tfoot><dl id='leQJo'><fieldset id='leQJo'></fieldset></dl></div>