Userdefined Constraints

User defined names to Constraints:- Constraints can be given a unique user-defined name along with the constraint definition. A constraint can be dropped by referring to the constraint by its name. under these circumstances a user defined constraint name becomes very convenient.
If oracle generated names are to be used, it becomes difficult to search for and identified the required constraint to be dropped. Hence user named constraint simplifies the task of dropping constraints.
Syntax:-  CONSTRAINT <constraint name><constraint definition>
Ex:-     1) create table product (pno number(5) constraint p_key primary key,
            na varchar2(20),qty number(5));
            Insert into product values(100,’rin’,25);
      2) create table product1(pno number(5),na varchar2(20),
      Qty number(5),constraint f_key foreign key(pno) references product);
      Insert into product1 values(100,’rin’,5);

 

For
Online Classes

Contact Us: +919885348743