我们可以在oracle中命名默认约束吗 [英] can we name a default constraint in oracle

查看:89
本文介绍了我们可以在oracle中命名默认约束吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MS-SQL中,我们在创建表期间可以具有以下约束条件

In MS-SQL we can have the following constraint during table creation

create table test
(
  WarningEnabled bit NOT NULL CONSTRAINT DF_WarningEnabled   DEFAULT 1,
);

如我们所见,

我已经给Default约束起了一个名字.是否可以在oracle中做到这一点

as we can see, i have given a name for Default constraint. IS it possible to do this in oracle

推荐答案

否. Oracle不会将默认值实现为约束,因此无法命名该约束.您也将无法在数据字典视图中看到与约束相关的默认约束(即ALL_CONSTRAINTSDBA_CONSTRAINTSUSER_CONSTRAINTS).您必须从DBA_TAB_COLUMNS(或ALL_TAB_COLUMNSUSER_TAB_COLUMNS)中查询DATA_DEFAULT列,具体取决于您的权限和感兴趣的列.

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).

这篇关于我们可以在oracle中命名默认约束吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆