h2ddl

NUMBER type in h2 database


In Oracle, I have a field of table defined as

NUMBER(6,0)

How can I define an equivalent field on a new table in H2 DB?


Solution

  • NUMERIC seems to be the right type.

    From h2 documentation:

    Data type with fixed decimal precision and scale. This data type is recommended for storing currency values. If precision is specified, it must be from 1 to 100000. If scale is specified, it must be from 0 to 100000, 0 is default. See also numeric literal grammar. Mapped to java.math.BigDecimal.

    Example:

    NUMERIC(20, 2)