JUST DO IT ~

我只想当个程序员

oracle 表约束 涉及到字段

查询一个表的主键名称

select  *
  from dba_constraints t
  where t.table_name =upper('dl_cjhb')
      and t.constraint_type='P'


查询表的主键对应的字段列表


select  tt.column_name
  from dba_constraints t, dba_ind_columns tt
  where t.table_name =upper('dl_cjhb')
      and tt.table_name=t.table_name
      and t.constraint_type='P'
      and t.index_name = tt.index_name

dba_cons_columns



OWNER                          CONSTRAINT_NAME                CONSTRAINT_TYPE TABLE_NAME                     SEARCH_CONDITION                                                                 R_OWNER                        R_CONSTRAINT_NAME              DELETE_RULE STATUS   DEFERRABLE     DEFERRED  VALIDATED     GENERATED      BAD RELY LAST_CHANGE INDEX_OWNER                    INDEX_NAME                     INVALID VIEW_RELATED
------------------------------ ------------------------------ --------------- ------------------------------ -------------------------------------------------------------------------------- ------------------------------ ------------------------------ ----------- -------- -------------- --------- ------------- -------------- --- ---- ----------- ------------------------------ ------------------------------ ------- --------------










posted on 2008-06-14 21:33 小高 阅读(320) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

导航

<2008年6月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

统计

常用链接

留言簿(3)

随笔分类(352)

收藏夹(19)

关注的blog

手册

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜