Check
CHECK (Domain Integrity Constraint)
Business rule validations can be applied to a table column by using check constraint . CHECK constraints must be specified as a logical expression that evaluates either to TRUE or FALSE
Restrictions:- A check constraints has the following limitations.
- The condition must be a Boolean expression that can be evaluated using the values in the row being inserted or updated.
- The condition cannot contain sub queries or sequences
- The condition cannot include SYSDATE, UID, USER or USERENV sql functions.
Syntax:- Columnname datatype(size) CHECK (logical expression) à Column level
CHECK(logical expression),CHECK(logical expression),-- à Table level
Ex:- 1) create table product (pno number(5) CHECK(pno>100),na varchar2(20),
rate number(5));
insert into product values(101,’surf’,210);
- insert into product values(20,’cakes’,1200);
2) Create table product1(pno number(5),na varchar2(20),
rate number(5),CHECK(na=UPPER(na)));
insert into product1 values(100,’OIL’,20);
- insert into product1 values(200,’cake’,30);
For
Online Classes
Contact Us: +919885348743
Online Classes
Contact Us: +919885348743