<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 运算符来进行空安全相等性检查?

        Is there better Oracle operator to do null-safe equality check?(是否有更好的 Oracle 运算符来进行空安全相等性检查?)
            <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 运算符来进行空安全相等性检查?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to redirect the output of DBMS_OUTPUT.PUT_LINE to a file?(如何将 DBMS_OUTPUT.PUT_LINE 的输出重定向到文件?)
                  How do I get column datatype in Oracle with PL-SQL with low privileges?(如何使用低权限的 PL-SQL 在 Oracle 中获取列数据类型?)
                  Get a list of all functions and procedures in an Oracle database(获取 Oracle 数据库中所有函数和过程的列表)
                  Why cannot I create triggers on objects owned by SYS?(为什么我不能在 SYS 拥有的对象上创建触发器?)
                  Returning result even for elements in IN list that don#39;t exist in table(即使对于表中不存在的 IN 列表中的元素也返回结果)
                  Reset Sequence in oracle 11g(oracle 11g 中的重置序列)

                  <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>
                        <tbody id='PkAi6'></tbody>

                          <bdo id='PkAi6'></bdo><ul id='PkAi6'></ul>
                        • <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>