recently, while working on a db2 -> oracle migration project, we came across this situation. the developers were inadvertently creating new table structures using decimal(s,p) columns. I didn't remember Oracle supporting this, but then some digging showed that its a ANSI data type therefore supported by oracle.
However, question for me remained -
- how is this data handled internally ?
- is there a cost of using ANSI types instead of Oracle's built in types ?
- Will there be an impact during the data migration if the target type was Oracle built-in type ?
Actually, there is difference between decimal and number. Decimal will truncate the value which is over-scale, number will round the value.
In Oracle, they are the same:
The table below this quote shows that
DECIMAL(p,s)
is treated internally as aNUMBER(p,s)
:However, the scale defaults to 0 for
DECIMAL
, which means thatDECIMAL(*)
is treated asNUMBER(*, 0)
, i.e.INTEGER
: