MONEY(p,s)
The MONEY
data type is provided to store currency
amounts with exact decimal storage.
Syntax
MONEY [
(precision[
,scale]
) ]
- precision defines the number of significant digits (limit is 32, default is 16).
- scale defines the number of digits to the right of the decimal point.
- When no scale is specified, it defaults to 2.
- When no (precision, scale) is specified,
it defaults to
MONEY(16,2)
.
Usage
The MONEY
data type is provided to store currency amounts. Its behavior is
similar to the DECIMAL
data type, with some important differences:
A MONEY
variable is displayed with the currency symbol defined in the
DBFORMAT (or DBMONEY) environment variable.
When the the scale is not specified for the MONEY
type,
the default is 2. A MONEY
without precision and
scale defaults to MONEY(16,2)
.
Data type conversion can be controlled by catching the runtime exceptions. For more details, see Handling type conversion errors.
See DECIMAL(p,s) to learn other facts about the
MONEY(p,s)
data type.