以下の内容はhttps://gblog.hatenablog.jp/entry/2019/04/18/101744より取得しました。


NULL は、「= NULL」 では抽出できない。

※ 12.2 で動作確認

SQL> select 1 from dual where NULL = NULL;

no rows selected

SQL> select 1 from dual where NULL is NULL;

         1
----------
         1

 

一体、「= NULL」にどんな意味が?

 

ちなみに、空文字「''」でも不思議な挙動。。。

これ、1個目のSQLは、TRUEになると思ってた。。。

SQL> select 1 from dual where ''  = '';

no rows selected

SQL> select 1 from dual where ' ' = ' ';

         1
----------
         1

 

 

ちょっと話が違うけど、IN 句に NULL をいれるとエラーにはならない。

(何も入れないとエラーになる)

SQL> select 1 from dual where NULL IN ();
select 1 from dual where NULL IN ()
                                  *
ERROR at line 1:
ORA-00936: missing expression


SQL> select 1 from dual where NULL IN (NULL);

no rows selected



以上の内容はhttps://gblog.hatenablog.jp/entry/2019/04/18/101744より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14