Skip to Content
0
Jul 25, 2019 at 09:14 AM

HANA Switch off automatic cutting of doubles

71 Views Last edit Jul 25, 2019 at 09:31 AM 2 rev

Hi all!

Some countings in HANA is cut off to 6 digits after comma. How to switch off this behavior?

Next SELECT returns clipped result:

DO BEGIN
	DECLARE cur_date date = add_days(current_date,-1); 
	DECLARE cur_date_time TIMESTAMP = TO_TIMESTAMP(TO_CHAR(CONCAT(cur_date, ' 22:00:00'), 'YYYY-DD-MM HH24:MI:SS'), 'YYYY-DD-MM HH24:MI:SS'); 
	DECLARE date_time_end TIMESTAMP = TO_TIMESTAMP(TO_CHAR(CONCAT(cur_date, ' 22:34:37'), 'YYYY-DD-MM HH24:MI:SS'), 'YYYY-DD-MM HH24:MI:SS'); 
	
	SELECT
		SECONDS_BETWEEN(cur_date_time,date_time_end) / 3600 AS c1
	FROM DUMMY;
END 
RESULT

C1
---
0.576944

If to add to int result small double then result is more expected:

....
		(0.0000000000000000000000000001 + SECONDS_BETWEEN(cur_date_time,date_time_end)) / 3600 AS c1
....
RESULT

C1
---
0.5769444444444444444444444444444722

Thanks for advance