Unanswered: cannot add a fractional number to numeric field
i am working with Visual Basic & postgres. using ADO and ODBC to connect to postgres. when i run the following query to update a
numeric(19,4) field an error occurs.
Update Accounts Set ClosingBal = ClosingBal + 900.50 Where AcCode = 105;
the error message is
"ERROR: Unable to identify an operator '+' for types 'numeric' and 'double precision'
You will have to retype this query using an explicit cast" .
if the value is a whole number like 900, the same query works fine.
and also if i use an explicit cast it works correctly. but i cannot use casts always because this numeric field is used for many calculations and queries.
can we create a userdefined + operator to avoid explicit casting.
or can we set any option to use automatic casting in postgres. there will not be any problem in automatic casting.
if i change the data type to float insted of numeric it will work corectly.
but i need a monitory precision of 4 digits.
is there any data type that can be used to store money.