Oracle data types: is there a built-in Currency/Money type?

Difficulty: Easy

Correct Answer: Invalid (Oracle has no Currency or Money data type; use NUMBER with formats)

Explanation:


Introduction / Context:
Oracle supports numeric storage via the versatile NUMBER type. Monetary values are commonly stored as NUMBER with appropriate scale and formatting at the presentation layer. This question addresses a common misconception that there is a special Currency or Money data type in Oracle.


Given Data / Assumptions:

  • Application must store monetary amounts in Oracle Database.
  • NLS settings may control symbols and formats for display.
  • Data integrity and precision are important.


Concept / Approach:
Store currency amounts in NUMBER(p,s) (for example, NUMBER(19,4)) to allow needed precision. Present the value with a currency symbol using TO_CHAR with a format model (for example, L999G999D99) or in the application layer. There is no built-in MONEY/CURRENCY data type; therefore, the statement that “Money is defined with the Currency data type” is incorrect.


Step-by-Step Solution:

Create column: amount NUMBER(19,4)Insert precise decimal values; avoid floating types for money.Format at query time: TO_CHAR(amount, 'L999G999D99')Store currency code (for example, ISO 4217) separately if multi-currency is required.


Verification / Alternative check:
Querying USER_TAB_COLUMNS shows NUMBER as the underlying type. Display of currency symbols depends on NLS and format models, not on a special data type.


Why Other Options Are Wrong:

  • Claiming a Currency type is false; XE and NLS do not add such a native type.
  • Storing money as CHAR is poor practice and loses numeric semantics.


Common Pitfalls:
Using FLOAT/DOUBLE (binary floating) for money; mixing currency symbol in stored values; ignoring rounding rules.


Final Answer:
Invalid (Oracle has no Currency or Money data type; use NUMBER with formats)

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion