Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ORACLE NUMBER(*,0) equivalent in POSTGRESQL

I have a table in ORACLE with a column which has a data type of NUMBER(*,0). As per my understanding it means precision will be 38 since that is the maximum limit of precision and scale value will be 0 which means no numbers will be allowed after decimal point i.e. will store integers?

I have a requirement where I have to create same table in PostgreSQL. Is it possible to write NUMERIC(*,0) in PostgreSQL? If not, what will be PostgreSQL equivalent of NUMBER(*,0)?

like image 823
Hetal Rachh Avatar asked Jun 07 '26 07:06

Hetal Rachh


1 Answers

Postgres supports arbitrary precision numeric values. The Oracle number type has up to 38 digits of precision. So, the type:

number(*, 0)

is really:

number(38, 0)

The equivalent in Postgres is:

numeric(38)

or:

numeric(38, 0)

However, Postgres supports ridiculously large precisions and scales. So if you specify: numeric

You will be able to represent any number that you are likely to encounter or need in your lifetime.

like image 122
Gordon Linoff Avatar answered Jun 09 '26 02:06

Gordon Linoff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!