In MS-SQL we can have the following constraint during table creation
create table test
(
WarningEnabled bit NOT NULL CONSTRAINT DF_WarningEnabled DEFAULT 1,
);
as we can see, i have given a name for Default constraint. IS it possible to do this in oracle
No. Oracle does not implement a default value as a constraint so there is no way to name the constraint. You also won't be able to see the default constraint in the data dictionary views that relate to constraints (i.e.
ALL_CONSTRAINTS
,DBA_CONSTRAINTS
,USER_CONSTRAINTS
). You'd have to query theDATA_DEFAULT
column fromDBA_TAB_COLUMNS
(orALL_TAB_COLUMNS
orUSER_TAB_COLUMNS
depending on your privileges and the column you're interested in).