db2 報錯 信息
SQL 錯誤 [42911]: A decimal divide operation is not valid because the result would have a negative scale.. SQLCODE=-419, SQLSTATE=42911, DRIVER=4.16.53
A decimal divide operation is not valid because the result would have a negative scale.. SQLCODE=-419, SQLSTATE=42911, DRIVER=4.16.53
A decimal divide operation is not valid because the result would have a negative scale.. SQLCODE=-419, SQLSTATE=42911, DRIVER=4.16.53
An error occurred during implicit system action type "2". Information returned for the error includes SQLCODE "-419", SQLSTATE "42911" and message tokens "42911".. SQLCODE=-727, SQLSTATE=56098, DRIVER=4.16.53
錯誤代碼:SQLCODE=-419 十進制除法運算無效
select a.ywl,rs.rs from temp a;
然後執行的語句:select a.ywl/rs.rs from temp a 就會報以上的錯誤
通過各種博客記錄,提出報錯信息的博客很多,但解決問題不太好找,再找到 參考解決辦法原博客 得以解決;
解決語句1: select a.ywl/dec(rs.rs,25,2) from temp a,即可進行解決
然後dec着實沒有見過,與decimal看起來像,類似,於是使用 cast(rs.rs as decimal(25,2))替代dec(rs.rs,25,2) ,發現也可以解決
解決語句2:select a.ywl/cast(rs.rs as decimal(25,2)) from temp a
發現解決方法着實難找,記錄以下,以便日後查詢。