带有假定空值的sql解码 - 意外结果

时间:2014-04-17 21:45:51

标签: sql oracle

我无法理解以下查询的结果:

select 
  trim(custodian) CUST, 
  length(trim(custodian)) LNGTH, 
  ascii(trim(custodian)) ASCII, 
  decode(trim(custodian), null, 'EMPTY', 'NOT EMPTY') DECOD
from collateral_detail 
where booking_id = '36795';

输出:

CUST     LNGTH     ASCII     DECOD     
-------- --------- --------- ----------- 
         1         0         NOT EMPTY

使用SQL Loader,Oracle 9i数据库加载数据。

当我手动将保管人值设置为空或''时,解码将返回' EMPTY'如预期的那样。

0 个答案:

没有答案