MONEY(p,s) data type

The MONEY data type stores currency amounts.

TLike the DECIMAL(p,s) data type, MONEY can store fixed-point numbers up to a maximum of 32 significant digits, where p is the total number of significant digits (the precision) and s is the number of digits to the right of the decimal point (the scale).

Unlike the DECIMAL data type, the MONEY data type is always treated as a fixed-point decimal number. The database server defines the data type MONEY(p) as DECIMAL(p,2). If the precision and scale are not specified, the database server defines a MONEY column as DECIMAL(16,2).

You can use the following formula (rounded down to a whole number of bytes) to calculate the byte storage for a MONEY data type:
If the scale is odd: N = (precision + 4) / 2
If the scale is even: N = (precision + 3) / 2

For example, a MONEY data type with a precision of 16 and a scale of 2 (MONEY(16,2)) requires 10 or (16 + 3)/2, bytes of storage.

In the default locale, client applications format values from MONEY columns with the following currency notation:
  • A currency symbol: a dollar sign ( $ ) at the front of the value
  • A thousands separator: a comma ( , ) that separates every three digits in the integer part of the value
  • A decimal point: a period ( . ) between the integer and fractional parts of the value

To change the format for MONEY values, change the DBMONEY environment variable. For valid DBMONEY settings, see DBMONEY environment variable.

The default value that the database server uses for scale is locale-dependent. The default locale specifies a default scale of two. For non-default locales, if the scale is omitted from the declaration, the database server creates MONEY values with a locale-specific scale.

The currency notation that client applications use is locale-dependent. If you specify a nondefault locale, the client uses a culture-specific format for MONEY values that might differ from the default U.S. English format in the leading (or trailing) currency symbol, thousands separator, and decimal separator, depending on what the locale files specify. For more information about locale dependency, see the HCL OneDB™ GLS User's Guide.