How to limit numeric columns to 32-bit and 64-bit values
Hi,
Is it possible to somehow limit the column datatype to 32-bit (or 64-bit) signed integer range of positive values, so that the permitted values would be within 0.. 2,147,483,647 for the 32-bit and 0.. 9,223,372,036,854,775,807 for the 64-bit. The reason is that we are using Java datatypes int and long to read data from the database and would like to constrain the maximum values at the database level.
An approach would probably be to define columns as NUMBER(10, 0) (or NUMBER(19, 0) for 64-bits) and add a CHECK constraint which would guarantee the value is within the boundaries, but is there any other solution? Unfortunately constrained datatypes http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/datatypes.htm#CHDBBCIE are available only in PL/SQL.
Thanks in advance.
Regards,
Jure