使用了STREAMS的库里会多一个约束类型!

本文解析了Oracle数据库中dba_constraints视图的使用方法及各种约束类型的含义,特别关注了较少见的约束类型11,即REF/ADT列的非空约束。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

SQL> select distinct CONSTRAINT_TYPE from dba_constraints
2 ;

V
R
U
P
?
C
O
--------------------------------------------------
C (check constraint on a table)
P (primary key)
U (unique key)
R (referential integrity)
V (with check option, on a view)
O (with read only, on a view)
SQL> select owner,
2 constraint_name,
3 table_name,
4 constraint_type,
5 search_condition, status
6 from dba_constraints
7 where constraint_type = '?'
8 ;

OWNER CONSTRAINT_NAME
------------------------------ ------------------------------
TABLE_NAME C
------------------------------ -
SEARCH_CONDITION
--------------------------------------------------------------------------------
STATUS
--------
SYS SYS_C001374
AQ$_REPLAY_INFO ?
"AGENT" IS NOT NULL
ENABLED


OWNER CONSTRAINT_NAME
------------------------------ ------------------------------
TABLE_NAME C
------------------------------ -
SEARCH_CONDITION
--------------------------------------------------------------------------------
STATUS
--------
SYS SYS_C001228
WRI$_ADV_DEFINITIONS ?
"TYPE" IS NOT NULL
ENABLED
SQL> select distinct type# from sys.cdef$ order by 1;

TYPE#
----------
1
2
3
4
5
6
7
11
Notice constraint type 11. So what is constraint type 11? And does this match what you are seeing in your database?

DBA_CONSTRAINTS视图的基表是 SYS.CDEF$ 。查看脚本?/rdbms/admin/sql.bsq可看基表的定义。
create table cdef$ /* constraint definition table */
( con# number not null, /* constraint number */
obj# number not null, /* object number of base table/view */
cols number, /* number of columns in constraint */
type# number not null, /* constraint type: */
/* 1 = table check, 2 = primary key, 3 = unique, */
/* 4 = referential, 5 = view with CHECK OPTION, */
/* 6 = view READ ONLY check */
/* 7 - table check constraint associated with column NOT NULL */
/* 8 - hash expressions for hash clusters */
/* 9 - Scoped REF column constraint */
/* 10 - REF column WITH ROWID constraint */
/* 11 - REF/ADT column with NOT NULL const */
/* 12 - Log Groups for supplemental logging */
/* 14 - Primary key supplemental logging */
/* 15 - Unique key supplemental logging */
/* 16 - Foreign key supplemental logging */

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值