case when else end

langxingcs 2008-12-18 06:24:02
select a,(case string(c) when null then 0 when '' then 0 else c end) as c from aa;为什么c为空时不能显示为0?
...全文
188 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jdsnhan 2008-12-19
  • 打赏
  • 举报
回复
与数据库有关
isnull 是sql里面的吧。

oracle里面 select nvl(c,0) from aa

dyf0130 2008-12-19
  • 打赏
  • 举报
回复
--数字
select a,
isnull(c,0)
from aa

1楼罗嗦了吧?
liubocy 2008-12-18
  • 打赏
  • 举报
回复
楞是没看出来c是数字还是字符型的


--字符
select a,
( case when isnull(c,'') = '' then '0' else c end ) as c
from aa

--数字
select a,
( case when isnull(c,0) = 0 then 0 else c end ) as c
from aa

752

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧