Published on InterSystems Developer Community (https://community.intersystems.com)

ホーム > SQLでのNULLデータの取り扱い

記事
Tomoko Furuzono · 2022年3月29日 1m read

SQLでのNULLデータの取り扱い

これは、InterSystems FAQサイトの記事です。
 

SQLの場合、NULLデータと空文字列 ('')は区別されます。
それぞれの設定・確認方法は、以下のようになります。

(1) NULLデータ

【SQL】 

insert into test (a) values (NULL)
select * from test where a IS NULL

 

【InterSystems ObjectScript】

set x=##class(User.test).%New()
set x.a=""

 

(2) 空文字列 ('')

【SQL】

insert into test (a) values ('')
select * from test where a = ''

 

【InterSystems ObjectScript】

set x=##class(User.test).%New()
set x.a=$C(0)

 

詳細については、以下ドキュメントをご参照ください。

NULL および空文字列【IRIS】
NULL および空文字列

#ObjectScript #SQL #Caché #InterSystems IRIS

ソースURL:https://jp.community.intersystems.com/post/sql%E3%81%A7%E3%81%AEnull%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E5%8F%96%E3%82%8A%E6%89%B1%E3%81%84