select a/b from table

以上语句当中,如果b的值非零,那么,运行会正常。

如果b的值是零。那么运行时就会报错:“被零除错误”。

 

通过修改成以下可解决此问题!

select a/(case when b=0 then 1 else b end) from table

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2022-01-28
  • 2021-07-10
  • 2022-12-23
猜你喜欢
  • 2021-11-12
  • 2021-06-03
  • 2022-02-09
  • 2022-12-23
  • 2022-02-12
  • 2021-08-01
  • 2022-12-23
相关资源
相似解决方案