Just specify a length of 8 and an accuracy of 0. Like this
SQL> create table t8 (col1 number(8,0)) 2 / Table created. SQL> insert into t8 values (12345678) 2 / 1 row created. SQL> insert into t8 values (123456789) 2 / insert into t8 values (123456789) * ERROR at line 1: ORA-01438: value larger than specified precision allowed for this column SQL>
To ensure the exact length (all digits must be eight digits long), you need to use the CHECK constraint:
SQL> alter table t8 2 add constraint t8_ck check (length(col1) = 8) 3 / Table altered. SQL> insert into t8 values (1234567) 2 / insert into t8 values (1234567) * ERROR at line 1: ORA-02290: check constraint (APC.T8_CK) violated SQL>
APC
source share