Écrit par

Content Manager at InterSystems Developer Community
Article Irène Mykhailova · Mai 19, 2022 1m read

Gestion de null et '' en SQL et ObjectScript

Pour SQL, null et la chaîne vide ('') sont distinguées. Chaque méthode de définition/réception est la suivante.

(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) Chaîne vide ('')

【SQL】

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

【InterSystems ObjectScript】

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

Pour plus de détails, veuillez consulter les documents suivants.

NULL and the Empty String (IRIS)
NULL and the Empty String (Caché)