开发者

corverting null to 0

开发者 https://www.devze.com 2023-01-30 00:51 出处:网络
i tried to do this, (case when (PREPAYMENT_AMT != null) then 0 else (PREPAYMENT_AM开发者_StackOverflow中文版T) END)

i tried to do this,

(case when (PREPAYMENT_AMT != null) then 0 else (PREPAYMENT_AM开发者_StackOverflow中文版T) END)

why its still apper null???


I know in SQL, null is not equal to anything because it is the unknown value. How can one unknown equal another? It makes no sense. There are special operators to deal with null.

(case when (PREPAYMENT_AMT IS NULL) then 0 else (PREPAYMENT_AMT) END) 

There are also functions in most SQL languages to do what you want. In MS SQL Server, ISNULL(PREPAYMENT_AMT, 0) will do what you want. In MySQL, it's COALESCE(PREPAYMENT_AMT, 0).

You should know that I don't know what ireport is, so check your docs for how to handle nulls.


Because you're changing it to 0 if it's NOT null. You need AMT == null

0

精彩评论

暂无评论...
验证码 换一张
取 消