Primary Key Constraints

2002-11-26 Thread Mike Sardina
Is there an easy query to get a list of tables that don't have any primary key? I've tried a couple of different ones, but none of them work quite right. Seems like this should be easy. -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Mike Sardin INET: [EMAIL PRO

RE: Primary Key Constraints

2002-11-27 Thread Kieran Murray
Hi Mike, I presume you want to disregard System tables, so here goes select owner, table_name from dba_tables where owner not in ('SYS','SYSTEM','OUTLN','DBSNMP') minus select owner, table_name from dba_constraints where constraint_type = 'P'; -Original Message- Sent: Tuesday, Novembe

RE: Primary Key Constraints

2002-11-26 Thread Mercadante, Thomas F
Mike, How about: select table_name from user_tables a where not exists(select 1 from user_constraints b where a.table_name = b.table_name and b.constraint_type = 'P'); Constraint_type values are: P = Primary Key C = Check Constraint R = Referential

Re: Primary Key Constraints

2002-11-26 Thread Igor Neyman
select owner, table_name from dba_tables where (owner, table_name) not in (select owner, table_name from dba_constraints where constraint_type = 'P'); Igor Neyman, OCP DBA [EMAIL PROTECTED] - Original Message - To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]> Sent: Tuesda

RE: Primary Key Constraints

2002-11-26 Thread Fink, Dan
SQL> select table_name 2 from dba_tables 3 minus 4 select table_name 5 from dba_constraints 6 where constraint_type = 'R'; This should work (does in my 8.1.7 test db). What methods have you tried? and what was not working? -Original Message- Sent: Tuesday, November 26, 200

Re: Primary Key Constraints

2002-11-26 Thread Dennis M. Heisler
select owner, table_name from dba_tables where not exists (select 'a' from dba_constraints where constraint_type = 'P' and owner = dba_tables.owner and table_name = dba_tables.table_name) order by owner, table_name; Mike Sardina wrote: > > Is there an easy query to get a list of tables that don'

RE: Primary Key Constraints

2002-11-26 Thread Whittle Jerome Contr NCI
Title: RE: Primary Key Constraints SELECT owner, table_name FROM DBA_TABLES t WHERE NOT EXISTS   (SELECT 'X'   FROM DBA_CONSTRAINTS c   WHERE c.owner = t.owner   AND c.table_name = t.table_name   AND c.constraint_type = 'P') ORDER BY 1,2 Take off the ORDER B

RE: Primary Key Constraints

2002-11-26 Thread mantfield
dina [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, November 27, 2002 6:25 AM To: Multiple recipients of list ORACLE-L Subject: Primary Key Constraints Is there an easy query to get a list of tables that don't have any primary key? I've tried a couple of different ones, but none of t

Re: Primary Key Constraints

2002-11-26 Thread John Shaw
how about select table_name from user_tables where table_name not in (select table_name from user_constraints where constraint_type = 'P');>>> [EMAIL PROTECTED] 11/26/02 01:25PM >>>Is there an easy query to get a list of tables that don't have any primarykey?  I've tried a couple of different

RE: Primary Key Constraints

2002-11-26 Thread Magaliff, Bill
try this: select table_name from user_tables minus select table_name from user_constraints where constraint_type = 'P'; -Original Message- Sent: Tuesday, November 26, 2002 2:25 PM To: Multiple recipients of list ORACLE-L Is there an easy query to get a list of tables that don't have any

Re: Primary Key Constraints

2002-11-26 Thread Arup Nanda
it's sure easy enough SELECT (OWNER, TABLE_NAME) FROM DBA_TABLES WHERE (OWNER, TABLE_NAME) NOT IN (SELECT OWNER, TABLE_NAME FROM DBA_CONSTRAINTS WHERE CONSTRAINT_TYPE = 'P') HTH Arup Nanda - Original Message - To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]> Sent: Tuesday,

RE: Primary Key Constraints

2002-11-26 Thread Stephane Paquette
Another way : select t.owner, t.table_name from dba_tables t minus select c.owner, c.table_name from dba_constraints c where c.constraint_type='P' ; --- "Mercadante, Thomas F" <[EMAIL PROTECTED]> a écrit : > Mike, > > How about: > > select table_name from user_tables a > where not exist

Re: Primary Key Constraints

2002-11-26 Thread Krishna Rao Kakatur
select table_name from user_tables minus select table_name from user_constraints where constraint_type='P'; HTH, Krishna - Original Message - To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]> Sent: Tuesday, November 26, 2002 11:25 AM > Is there an easy query to get a list