Default Value

At the time of table creation a default values can ne assigned to a column. When the user is loading a record with values and leaves this column empty, the oracle engine will automatically load this column with the dfaulet value specified . the data type of the default value should match the data type of the column. You can use the DEFAULT clause to specify a default value for a column.
Rules:-

Syntax:- 1)columnname datatype(size) default (value);
2) columnname datatype(size) default(value) constraint definition;
Ex:-1)  create table stock (icode number(5),name varchar2(20),
qty number(5) default(10));
Insert into stock values(100,’surf’,20);
Insert into stock (icode,name) values(200,’oils’);
Select * from stock;
2) create table stock1(icode number(5) default 5 not null,na varchar2(20),
qty number(5));
insert into stock1 values(100,’froots’,2000);
insert into stock1(na,qty) values (‘oils’,4000);

 

For
Online Classes

Contact Us: +919885348743