Cast and Sum functions
I am writing a macro which pulls data from Oracle and displays in Excel. In Oracle DB we have a custom table with a column Named "Calculated_Quantity". The datatype of this column is BINARY_DOUBLE. However when I write a query in Excel macro to retreive this column, I get the error as "Data Type is not Supported". So I had to use "Cast" function to bypass this error.
Now I need to sum this column. If I write the statement as
Select Id, SUM(CAST(CALCULATED_QUANTITY AS NUMBER(10))) Qty from DW.SAMPLE
it works fine, but the calculation is wrong.
If I write
Select Id, CAST(SUM(CALCULATED_QUANTITY AS NUMBER(10))) Qty from DW.SAMPLE
I get an error as missing right parenthesis. The parenthesis seem to be correct. Help please! –
Select Id, CAST(SUM(CALCULATED_QUANTITY) AS NUMBER(10)) Qty from DW.SAMPLE