attempted to return null from a method with a primitive return type (long).

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36802726/article/details/84138792

写了一个sql:select sum(game_score) from pt_game_recor

报错attempted to return null from a method with a primitive return type (long).

我的返回值类型为long,但是查询出来的结果有空值,所以会出现如上的异常,以下为解决办法:

将sql改为select IFNULL(sum(game_score),0) from pt_game_record

猜你喜欢

转载自blog.csdn.net/qq_36802726/article/details/84138792