Not Null Constraint:
====================
-Restricted nulls but accepting duplicates
-Not null an not be applied at table level
ex::
create table test1(eid int not null,ename varchar2(10) not null);
EX::
SQL> create table test1(eid int not null,ename varchar2(10) not null);
Table created.
SQL> insert into test1 values(10,'raja');
1 row created.
SQL> insert into test1 values(20,'dan');
1 row created.
SQL> select * from test1;
EID ENAME
---------- ----------
10 raja
20 dan
SQL> insert into test1 values(null,'dan');
insert into test1 values(null,'dan')
*
ERROR at line 1:
ORA-01400: cannot insert NULL into ("SYSTEM"."TEST1"."EID")
SQL> insert into test1 values(10,null);
insert into test1 values(10,null)
*
ERROR at line 1:
ORA-01400: cannot insert NULL into ("SYSTEM"."TEST1"."ENAME")
SQL> select * from test1;
EID ENAME
---------- ----------
10 raja
20 dan
SQL> insert into test1 values(10,'raja');
1 row created.
SQL> select * from test1;
EID ENAME
---------- ----------
10 raja
20 dan
10 raja
SQL> insert into test1 values(20,'randy');
1 row created.
SQL> select * from test1;
EID ENAME
---------- ----------
10 raja
20 dan
10 raja
20 randy
SQL> create table test2(eid int,ename varchar2(10),not null(eid,ename));
create table test2(eid int,ename varchar2(10),not null(eid,ename))
*
ERROR at line 1:
ORA-00904: : invalid identifier
Comments
Post a Comment