I am having trouble casting a double precision value to money.
SELECT scrap_cost.year AS year
, scrap_cost.weekly AS week
, scrap_cost.scrap_cost::MONEY
, labor_cost.labor_cost::MONEY
FROM ...
returns
ERROR: cannot cast type double precision to money
LINE 4: ..., scrap_cost.scrap_cost::MONEY, labor_cost.labor_cost::money
^
********** Error **********
ERROR: cannot cast type double precision to money
SQL state: 42846
Character: 117
What I did to solve this was CAST it as a numeric
first
SELECT
scrap_cost.year AS year
, scrap_cost.weekly AS week
, scrap_cost.scrap_cost::MONEY
, labor_cost.labor_cost::NUMERIC::MONEY
FROM ...
I found the solution in the postgres documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With