1. 下面的sql语句适用于Oracle,但是不适用于MySQL
SELECT * FROM table1 WHERE column1 is not null;--非空判断
SELECT * FROM table1 WHERE column1 is null;--空判断
2. 下面的sql语句适用于MySQL但是不适用于Oracle(刚开始用的时候好像没问题,但是之后再测的时候好像又不行了)
SELECT * FROM table1 WHERE column1 is not null and column1 != '';--非空判断
SELECT * FROM table1 WHERE column1 is null or column1 = '';--空判断
3. 下面的sql语句兼容Oracle和MySQL,DB2待测试
SELECT * FROM table1 WHERE column1 is not null and length(column1) > 0;--非空判断
SELECT * FROM table1 WHERE column1 is null or length(column1) = 0;--空判断