<legend id='f4r19'><style id='f4r19'><dir id='f4r19'><q id='f4r19'></q></dir></style></legend>
      <bdo id='f4r19'></bdo><ul id='f4r19'></ul>
    1. <tfoot id='f4r19'></tfoot>
      1. <small id='f4r19'></small><noframes id='f4r19'>

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

        是否有更好的 Oracle 运算符来进行空安全相等性检查?

        时间:2023-11-02
            <tbody id='lCXNk'></tbody>
        • <tfoot id='lCXNk'></tfoot>
          <legend id='lCXNk'><style id='lCXNk'><dir id='lCXNk'><q id='lCXNk'></q></dir></style></legend>
            <bdo id='lCXNk'></bdo><ul id='lCXNk'></ul>

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

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

                  本文介绍了是否有更好的 Oracle 运算符来进行空安全相等性检查?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  根据这个问题,执行的方式Oracle 中的相等检查,我希望将 null 视为相等的 null 类似于

                  According to this question, the way to perform an equality check in Oracle, and I want null to be considered equal null is something like

                  SELECT  COUNT(1)
                    FROM    TableA
                  WHERE 
                    wrap_up_cd = val
                    AND ((brn_brand_id = filter) OR (brn_brand_id IS NULL AND filter IS NULL))
                  

                  这确实会使我的代码变脏,尤其是当我有很多这样的 where 并且 where 应用于多个列时.有没有更好的替代方案?

                  This can really make my code dirty, especially if I have a lot of where like this and the where is applied to several column. Is there a better alternative for this?

                  推荐答案

                  好吧,我不确定这是否更好,但使用 LNNVL,一个函数(你只能在 WHERE 子句中使用),如果给定的表达式为 FALSE 或 UNKNOWN (NULL),则返回 TRUE.例如...

                  Well, I'm not sure if this is better, but it might be slightly more concise to use LNNVL, a function (that you can only use in a WHERE clause) which returns TRUE if a given expression is FALSE or UNKNOWN (NULL). For example...

                  WITH T AS
                  (
                      SELECT    1 AS X,    1 AS Y FROM DUAL UNION ALL
                      SELECT    1 AS X,    2 AS Y FROM DUAL UNION ALL
                      SELECT    1 AS X, NULL AS Y FROM DUAL UNION ALL
                      SELECT NULL AS X,    1 AS Y FROM DUAL
                  )
                  SELECT
                      *
                  FROM
                      T
                  WHERE
                      LNNVL(X <> Y);
                  

                  ...将返回除 X = 1 和 Y = 2 之外的所有行.

                  ...will return all but the row where X = 1 and Y = 2.

                  这篇关于是否有更好的 Oracle 运算符来进行空安全相等性检查?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 IN 子句中为 NUMBER 列使用逗号分隔值 下一篇:我们如何确定我的 oracle 表中的列正在被另一个表的触发器填充/更新?

                  相关文章

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

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

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