I have a currency value in a table that I want to include in an OBJECT. The problem is that it looks like Snowflake drops the 2 decimal place precision I want to keep when converting to an OBJECT.
Example:
<code>select to_number('124.00', 18, 2) desired_output, object_construct('my_key', to_number('124.00', 18, 2)) incorrect_output;
DESIRED_OUTPUT INCORRECT_OUTPUT
124.00 { "my_key": 124 }
</code>
<code>select to_number('124.00', 18, 2) desired_output, object_construct('my_key', to_number('124.00', 18, 2)) incorrect_output;
DESIRED_OUTPUT INCORRECT_OUTPUT
124.00 { "my_key": 124 }
</code>
select to_number('124.00', 18, 2) desired_output, object_construct('my_key', to_number('124.00', 18, 2)) incorrect_output;
DESIRED_OUTPUT INCORRECT_OUTPUT
124.00 { "my_key": 124 }
DESIRED_OUTPUT
is keeping the precision I want. But as soon as I try to set it as a value in the object, it gets dropped. Is there a way to keep the format without converting it to a VARCHAR?