You can translate the question and the replies:

How to use double as datatype

Hi, I'm currently working on a Impala query where I want to calculate the sum of a field in a table, and I need to cast it as a double. However, I'm encountering an error, and I could use some assistance. SELECT SUM(CAST(fieldname AS double)) FROM tablename; Unfortunately, I'm getting an error that says "error parsing command."
13-12-2023 00:47:17 -0500

1 Answer

Hi, I tried using the cast function and found that the value mentioned for the data type is incorrect. The correct format for the data type double is **double precision**. Please refer to the below syntax of the cast function: ``` CAST( <field name> as <data _type>); ``` For instance, the below statement would help in order to calculate the sum of the values in the field and cast it to double data type, ``` select sum(cast(<field_name> as double precision)) from tablename; ``` For further information, please refer to [CAST Conversion Functions]( document under the Virtual DataPort VQL Guide. If you still need further assistance and if you are a valid support user, you can raise a [Support Case](, for further assistance from the Support Team. Hope this helps!
Denodo Team
13-12-2023 07:20:16 -0500
You must sign in to add an answer. If you do not have an account, you can register here