kbhao7788 2017-04-29 00:45 采纳率: 0%
浏览 1061
已采纳

Oracle null的问题帮忙解决一下

select * from emp where comm not in (null);
select * from emp where comm in (null);
为什么都没有输出东西

  • 写回答

2条回答 默认 最新

  • 战在春秋 2017-04-29 08:28
    关注

    如下引自官方文档 (本来想翻译的,不过原文更准确)

    A null can be assigned but it cannot be equated with anything, including itself. NULL values represent missing or unknown data. NULL values are not an integer, a character, or any other specific data type. Note that NULL is not the same as an empty data string or the numerical value '0'.

    null 不能用 = 与任意值比较,甚至包括null 本身,也就是说即便是 null = null 也是没有意义的。

    select * from emp where comm not in (null); 相当于比较comm = null
    select * from emp where comm in (null); 相当于比较comm != null
    这二行语句都是无效语句
    

    oracle 有专门的 IS [NOT] NULL,用于测试表达式是否为null值。

    例如:

    SELECT *
    FROM suppliers
    WHERE supplier_name IS NULL;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog