通过查询获得某个字段的合计值,如果这个值位null将给出一个预设的默认值
select nvl(sum(t.dwxhl),1) from tb_jhde t where zydm=-1这里关心的nvl的用法,nvl(arg,value)代表如果前面的arg的值为null那么返回的值为后面的value

另一个有关的有用方法
declare i intener
select nvl(sum(t.dwxhl),1) into i from tb_jhde t where zydm=-
1这样就可以把获得的合计值存储到变量i中,如果查询的值为null就把它的值设置为默认的1

相关文章:

  • 2022-12-23
  • 2022-02-24
  • 2021-06-04
  • 2022-12-23
  • 2022-02-22
  • 2021-08-27
猜你喜欢
  • 2022-01-02
  • 2021-09-28
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
相关资源
相似解决方案