查询用户中哪些表没主键

SQL> select distinct c.table_name

  2  from user_constraints c
  3  where c.table_name not in(
  4  select  b.table_name
  5   from user_cons_columns a, user_constraints b
  6   where a.constraint_name = b.constraint_name
  7   and b.constraint_type = 'P' )
  8  ;

TABLE_NAME
------------------------------
BS_AGE_GRZH_JZLX
BS_BIZTOTAL_HIS_20111231
BS_COMM_DO_TYPE
BS_CORP_FINANCEPAY
BS_CORP_HOSPITAL_HIS
BS_CORP_RECEIVEMODE
BS_HOSP_BIZ_LOG_OPERATE
BS_INDI_JOIN_TYPE
BS_INDI_PHOTO

9   rows selected

发表评论

电子邮件地址不会被公开。