Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [money]

A data type to store monetary values

1
vote
4answers
2k views

Handling currencies in a database

How should money currency be handled in the database to be consistent? Should I choose the specific currency to use across my database or is it better to mix different values of different currencies? ...
0
votes
1answer
152 views

What is the best data type to store prices upto 8 decimals + indicators in SQLite?

I am developing a trading system which stores data in SQLite, consisting of OHLC and volume. I would also like to store some indicators like RSI etc I read the other answer which indicated integers as ...
0
votes
1answer
518 views

Handling differences between MS-SQL and PostgreSQL money datatypes [closed]

This is a follow-up/ to my previous question Is it possible to insert un-formatted data for money data type in PostgreSQL I could read money data by typecasting it into numeric SELECT '52093.89'::...
4
votes
2answers
1k views

Is it possible to insert un-formatted data for money data type in PostgreSQL

By default, PostgreSQL's money data type inserts values with currency code and grouping. I have observed that it always inserts values with $. How can I insert locale specific values? How can I ...
3
votes
1answer
2k views

ERROR: invalid input syntax for type money

While importing I get this error: pg_restore: [archiver (db)] COPY failed for table "transaction_details": ERROR: invalid input syntax for type money: "$0.00" restore completed, but the ...
4
votes
1answer
7k views

Exchange rate table and conversion on the fly in query

I'm working on a small project and I'm have arrived to the point where I let a user chose in which currency to display items. I'm working with Java and my first thought was that I would use some kind ...
5
votes
1answer
14k views

PostgreSQL and MONEY data type for currency values

For a project, I created a table with a column price MONEY NOT NULL column. And I thought it would handle decimals properly, unlike a floating number (i.e. IEEE rounding issues), but I end up having ...
0
votes
0answers
2k views

Storing currency with variable floating point in SQLite

We are working with currency and handle currencies from various countries. As a result, we may work with currencies that require no decimal values, two decimal places, three, sometimes four. We also ...
10
votes
3answers
3k views

Efficiently comparing prices in different currencies

I want to make it possible for user to search products within a price range. User should be able to use any currency (USD, EUR, GBP, JPY, ...), no matter what currency is set by the product. So, the ...
13
votes
2answers
24k views

Storing prices in SQLite, what data-type to use?

I am using SQLite and need to store prices. SQLite's REAL data-type says it uses floating-point which is unacceptable storage for prices. Is there a data-type besides TEXT that I can use to store ...
5
votes
3answers
23k views

How to change the datatype of a column from integer to money?

I am attempting to convert a PostgreSQL table column from integer to money, but I am receiving the error: cannot cast type MyColumn to money I have tried these two statements, but just haven't ...
2
votes
1answer
2k views

How can I alter the type of a money-column to decimal in PostgreSQL?

I have a table in PostgreSQL where one column "vat" has type money but I would like to alter it to decimal instead. How can I do it? I tried with: alter table my_table alter column vat type decimal;...