Re: Money Data type - Mailing list pgsql-novice

From Oliver Elphick
Subject Re: Money Data type
Date
Msg-id 200101111919.f0BJJcN16141@linda.lfix.co.uk
Whole thread Raw
In response to Money Data type  ("Mike Hammonds" <mhammonds@knowledgeinenergy.com>)
List pgsql-novice
"Mike Hammonds" wrote:
  >** Reply Requested When Convenient **
  >
  >What data type is = to money

There is a money datatype, which is now deprecated.  You should use
numeric(x,2) instead (where x is large enough to hold all the digits you
will ever need).  (Or numeric(x,0) for currencies like Yen or Italian Lire.)

The money datatype was only ever really good for maintaining data in one
currency.

If you want to record foreign currency values, you need at least these
columns:

  amount
  currency code
  exchange rate against, or amount in, reference currency

The third column is needed because exchange rates vary from day to day, so
the value in the reference currency needs to be established and
recorded.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Enter into his gates with thanksgiving, and into his
      courts with praise. Be thankful unto him, and bless
      his name."           Psalms 100:4



pgsql-novice by date:

Previous
From: Rosa Maria Carro Salas
Date:
Subject: RecordSets, getString and charSets
Next
From: "Poul Kristensen"
Date:
Subject: libpg.so.2.0 needed by php-pgsql.3.0.15