You can create a CHECK constraint that applies this constraint
SQL> create table foo ( 2 col1 varchar2(2) NOT NULL 3 ,check( length(col1) = 2 ) 4 ); Table created. SQL> insert into foo values( 'ab' ); 1 row created. SQL> ed Wrote file afiedt.buf 1* insert into foo values( 'a' ) SQL> / insert into foo values( 'a' ) * ERROR at line 1: ORA-02290: check constraint (SCOTT.SYS_C0022134) violated
source share