Constriant: check value between 0 and 100
SQL> -- Check
SQL>
SQL> create table myTable (
2 a number check (a between 0 and 100),
3 b number
4 );
Table created.
SQL>
SQL> insert into myTable values(1, 3);
1 row created.
SQL> insert into myTable values(2000, 3);
insert into myTable values(2000, 3)
*
ERROR at line 1:
ORA-02290: check constraint (SYS.SYS_C004423) violated
SQL> insert into myTable values(2, 3);
1 row created.
SQL>
SQL> select * from myTable;
A B
---------- ----------
1 3
2 3
SQL>
SQL> drop table myTable;
Table dropped.
SQL>
SQL>
Related examples in the same category