如何匹配DB2(z/OS)查询中的字符串?

m2g*_*een 3 db2 mainframe zos

这让我大吃一惊.

我想做的就是在长varchar场上进行基本的字符串比较.

我有一张大约一张桌子.12M记录.

如果我查询MY_FIELD='a string',我得到25947的计数,这似乎是正确的.

如果我查询MY_FIELD!='a string',我得到989的计数.

这两个计数不应该相加到12M的全表大小吗?

pax*_*blo 6

MY_FIELD设置了NULL多少行?

a. select count(*) from mytable;
b. select count(*) from mytable where my_field is null;
c. select count(*) from mytable where my_field is not null;
d. select count(*) from mytable where my_field = 'some value';
e. select count(*) from mytable where my_field != 'some value';
Run Code Online (Sandbox Code Playgroud)

NULL是不等于或不等于任何价值,包括NULL所以我期望d+e等同于cb+c等于a.