我这里'' 和null是不一样的.db2可以区分的
insert into tab values(1,'JACK','0001','2000');
insert into tab values(2,'TOM','0002','');
insert into tab values(3,'LUCY','0003','3000');
insert into tab values(4,'JAME','0004','');
insert into tab values(4,'KIM','0005',null);
db2 => select * from tab;
select * from tab
ID NAME EMPID SALARY
----------- -------------------------------------------------- ---------- ---------------
1 JACK 0001 2000
2 TOM 0002
3 LUCY 0003 3000
4 JAME 0004
4 KIM 0005 -
5 record(s) selected.
db2 => select * from tab where salary not in ('2000','3000');
select * from tab where salary not in ('2000','3000')
ID NAME EMPID SALARY
----------- -------------------------------------------------- ---------- ---------------
2 TOM 0002
4 JAME 0004
2 record(s) selected.
db2 => select * from tab where salary is null;
select * from tab where salary is null
ID NAME EMPID SALARY
----------- -------------------------------------------------- ---------- ---------------
4 KIM 0005 -
1 record(s) selected
追问您好,你的解释是对的,db2 本来就是分''和null的,Oracle似乎是不分的,但是我现在用的db2 10,结果不分了,应该是数据库哪个配置没有配置好,开始以为是db2 兼容Oracle特性开了,结果给关了依然把''当成null,所以很费解,对于您的感谢,您的回答 我给设为满意了