Home > Mobile >  How to solve that snowflake force the very small result of integer division to zero
How to solve that snowflake force the very small result of integer division to zero

Time:01-18

I'm writing a snowflake query that calculate 1/2940744 and get the result equals to 0 How to solve to get the actual calculation result?

CodePudding user response:

select 1::float/2940744

The enter image description here

CodePudding user response:

From docs:

enter image description here

The value 0.00000034005 was rounded to 0. In order to change the behaviour one of the arguments could be explicitly casted:

 SELECT 1::NUMBER(38,12)/2940744;
 -- 0.00000034005

 DESC RESULT LAST_QUERY_ID();
 -- 1::NUMBER(38,12)/2940744    NUMBER(38,12)
  • Related