Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

CE_CALC issue when division results in < 0

$
0
0

I have a calc view that has 2 sql statements getting counts and then I need to divide one by the other and * 100 to get the percentage.  When I use CE_CALC and the result of the division is < 0 (even if I then multiply by 100) my result is always 0.  If the result of the division is positive, it works fine.  I have also replaced the variables with actual integer values and the result is the same.

 

This always results in 0 as long as TOTALSHIPPEDBYFCD is < TOTALFCDTODAY:

 

var5 = CE_PROJECTION(:var4, ["TOTALFCDTODAY", "TOTALSHIPPEDBYFCD",

CE_CALC('(("TOTALSHIPPEDBYFCD" / "TOTALFCDTODAY") * 100)',

decimal(10,2)) AS "PERCENTSHIPPEDBYFCD"]);

 

This works but I would rather use the CE functions:

var5 = SELECT TOTALFCDTODAY, TOTALSHIPPEDBYFCD,

cast((TOTALSHIPPEDBYFCD)/(TOTALFCDTODAY)*100 as decimal(10,2)) as PERCENTSHIPPEDBYFCD

                FROM :var4

               ;

 

Do you think this is a bug?

 

Thanks,

Amy


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>