oracle,sql查询空值赋不了值
select a.payment_name, a.payment_desc, (select nvl(b.enabled, 0) from ecm_payment b where a.payment_name = b.payment_name and b.store_id = 2) as enabled from ecm_platform_payment a where a.enabled = 1
执行结果enabled为什么会是空值啦。。毕业论文
求解。。
他的 值是 "" 而并非 是 null
你用 decode(enabled,null,0,'',null,0,enabled)
用这个 试一下 吧
select a.payment_name,
a.payment_desc,
NVL(select nvl(b.enabled, 0)
from ecm_payment b
where a.payment_name = b.payment_name
and b.store_id = 2),0) as enabled
from ecm_platform_payment a
where a.enabled = 1