dba_objects 中不包含 constraint

psufnxk2000發表於2014-04-28
dba_objects 中不包含 constraint,  
其基表 obj$中也不包含 constraint;
constraint (約束)的基表是 con$.


SQL> conn song/song
Connected.


SQL> drop table t purge;


Table dropped.


SQL> create table t (id number);


Table created.


SQL> alter table t add primary key (id);


Table altered.


SQL> select constraint_name from user_constraints where table_name='T';


CONSTRAINT_NAME
------------------------------------------------------------
SYS_C007611


SQL> SELECT index_name from user_indexes where index_name='SYS_C007611';


INDEX_NAME
------------------------------------------------------------
SYS_C007611




SQL> SELECT OBJECT_NAME,OBJECT_TYPE FROM USER_OBJECTS WHERE OBJECT_NAME='SYS_C007611';


OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE
--------------------------------------
SYS_C007611
INDEX
從 obj$表的欄位中可以看出:
type#         number not null,                 /* object type (see KQD.H): */
  /* 1 = INDEX, 2 = TABLE, 3 = CLUSTER, 4 = VIEW, 5 = SYNONYM, 6 = SEQUENCE, */
             /* 7 = PROCEDURE, 8 = FUNCTION, 9 = PACKAGE, 10 = NON-EXISTENT, */
              /* 11 = PACKAGE BODY, 12 = TRIGGER, 13 = TYPE, 14 = TYPE BODY, */
      /* 19 = TABLE PARTITION, 20 = INDEX PARTITION, 21 = LOB, 22 = LIBRARY, */
                                             /* 23 = DIRECTORY , 24 = QUEUE, */
    /* 25 = IOT, 26 = REPLICATION OBJECT GROUP, 27 = REPLICATION PROPAGATOR, */
    /* 28 = JAVA SOURCE, 29 = JAVA CLASS, 30 = JAVA RESOURCE, 31 = JAVA JAR, */
                 /* 32 = INDEXTYPE, 33 = OPERATOR , 34 = TABLE SUBPARTITION, */
                                                  /* 35 = INDEX SUBPARTITION */
                                                 /* 82 = (Data Mining) MODEL */
  
  這裡的型別也沒有 constraint.
  
  SQL> select name from con$ where name='SYS_C007611';


NAME
------------------------------------------------------------
SYS_C007611

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25099483/viewspace-1151222/,如需轉載,請註明出處,否則將追究法律責任。

相關文章