语法:
case when 条件 then 值1 else 值2 end
示例:
select (case when t.project_id=‘0’ then 1 else ln(t.project_id) end) LN from MES2_BYD_SHOPORDER t
当t.project_id等于0时,返回1,否则返回ln(t.project_id)。这样可以防止ln()中参数为0而报错。
结果:
相关文章:
语法:
case when 条件 then 值1 else 值2 end
示例:
select (case when t.project_id=‘0’ then 1 else ln(t.project_id) end) LN from MES2_BYD_SHOPORDER t
当t.project_id等于0时,返回1,否则返回ln(t.project_id)。这样可以防止ln()中参数为0而报错。
结果:
相关文章: