ORACLE不等于条件会过滤掉值为null的记录
不等于符号会把code为null的记录过滤掉
SELECT * FROM person WHERE sex='女' and code != 'xxx';
解决方法:
SELECT * FROM person WHERE sex='女' and (code != 'xxx' or code is null);
或
SELECT * FROM person WHERE sex='女' and NVL(code,0) != 'xxx';
不等于符号会把code为null的记录过滤掉
SELECT * FROM person WHERE sex='女' and code != 'xxx';
解决方法:
SELECT * FROM person WHERE sex='女' and (code != 'xxx' or code is null);
或
SELECT * FROM person WHERE sex='女' and NVL(code,0) != 'xxx';