can we name a default constraint in oracle

做~自己de王妃 提交于 2019-12-10 14:52:33

问题


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


回答1:


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 the DATA_DEFAULT column from DBA_TAB_COLUMNS (or ALL_TAB_COLUMNS or USER_TAB_COLUMNS depending on your privileges and the column you're interested in).



来源:https://stackoverflow.com/questions/10300630/can-we-name-a-default-constraint-in-oracle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!