| |
GeekInterview.com > Interview Questions > Oracle > SQL Plus
| Print | |
Question: Default Constraint
Answer: What is default constraint? How we you apply it? |
| January 01, 2009 10:20:38 |
#3 |
| sreekanthjup |
Member Since: January 2009 Total Comments: 1 |
RE: Default Constraint |
Default Contraint acts the same way as the other constraints like NOT NULL, UNIQUE, PRIMARY KEY............. do; they come into picture while data insertion is done into the table. It makes oracle insert a values automatically into table without being specified in the insert; for example:
CREATE TABLE TTEMP (NM VARCHAR2(10) DEFAULT 'Sreekanth', JOB VARCHAR2(10));
now we can skip from the NM column being filled: INSERT INTO TTEMP VALUES (null,'sales'); or INSERT INTO TTEMP VALUES ('','sales'); in ordinary case without default constraint assigned.. NULL gets inserted but here 'Sreekanth' is inserted in each unspecified row.
|
| |
Back To Question | |