【发布时间】:2009-01-16 16:37:52
【问题描述】:
SQL中有nvl()等价函数吗?
或者在某些场景中以相同方式使用的足够接近的东西?
更新:
没有 if 语句
没有 case 语句
没有 isnull
没有合并
select nvl (purge_date,"SODIUFOSDIUFSDOIFUDSF") from id_rec where id=36581;
(expression)
SODIUFOSDIUFSDOIFUDSF
1 row(s) retrieved.
select isnull (purge_date,"SODIUFOSDIUFSDOIFUDSF") from id_rec where id=36581;
674: Routine (isnull) can not be resolved.
Error in line 1
Near character position 8
select coalesce (purge_date,"SODIUFOSDIUFSDOIFUDSF") from id_rec where id=36581;
674: Routine (coalesce) can not be resolved.
Error in line 1
Near character position 8
select decode(purge_date, NULL, "01/01/2009", purge_date) from id_rec where id=74115;
800: Corresponding types must be compatible in CASE expression.
Error in line 1
Near character position 57
【问题讨论】:
-
您使用的确切版本会有所帮助。另外,如果 nvl 有效,为什么不使用它呢?
-
我不确定如何找出我正在使用的版本。它的 informix 和旧版本...对于一种情况,nvl 不起作用,我不知道为什么
-
NVL 导致问题的场景是什么?
-
我的一张表中有一个字段为“null”(“”或“”),它应该是某人的名字。我们为一般用途设置了一个键,从未输入名称。它最终击中了粉丝,我不得不修复它,但 NVL 没有这样做,我不得不用一堆 BS 解决它
-
不要忘记,与其他一些系统不同,Informix 不会将空字符串视为 NULL——两者是不同的。运行带有“-V”选项的 Informix 程序应该会打印一些版本信息。您选择的程序名称也可能有所帮助。