dbTalk Databases Forums  

Tables without primary key

comp.databases.oracle comp.databases.oracle


Discuss Tables without primary key in the comp.databases.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Michael Maier
 
Posts: n/a

Default Tables without primary key - 09-08-2004 , 03:01 AM






Hi,

for an OnlinerReorg (SAP/ORACLE) i have to know the name of the tables
without primary key.

Where can i find it with sqlplus or abap?

THX

Best Regards,
Micha

Reply With Quote
  #2  
Old   
Mark C. Stock
 
Posts: n/a

Default Re: Tables without primary key - 09-08-2004 , 04:51 AM







"Michael Maier" <maier_michael2003 (AT) yahoo (DOT) de> wrote

Quote:
Hi,

for an OnlinerReorg (SAP/ORACLE) i have to know the name of the tables
without primary key.

Where can i find it with sqlplus or abap?

THX

Best Regards,
Micha
assuming SAP uses database constraints, these are all listed in the
DBA_CONSTRAINTS (or USER_CONSTRAINTS) data dictionary view, CONSTRAINT_TYPE
= 'P'

you can write a query outer joining this to DBA_TABLES (or USER_TABLES) and
check for NULL constraint names, or use a MINUS type query

are you familiar with these techniques?

++ mcs




Reply With Quote
  #3  
Old   
Christine
 
Posts: n/a

Default Re: Tables without primary key - 09-08-2004 , 08:51 PM



"Mark C. Stock" <mcstockX@Xenquery .com> wrote

Quote:
"Michael Maier" <maier_michael2003 (AT) yahoo (DOT) de> wrote in message
news:99f00224.0409080001.2142293e (AT) posting (DOT) google.com...
| Hi,
|
| for an OnlinerReorg (SAP/ORACLE) i have to know the name of the tables
| without primary key.
|
| Where can i find it with sqlplus or abap?
|
| THX
|
| Best Regards,
| Micha

assuming SAP uses database constraints, these are all listed in the
DBA_CONSTRAINTS (or USER_CONSTRAINTS) data dictionary view, CONSTRAINT_TYPE
= 'P'

you can write a query outer joining this to DBA_TABLES (or USER_TABLES) and
check for NULL constraint names, or use a MINUS type query

are you familiar with these techniques?

++ mcs
Here you are. ^_^

select owner, table_name
from dba_tables
where table_name not in
(select TABLE_NAME
from dba_constraints
where CONSTRAINT_TYPE='P')
and owner not in ('SYS', 'SYSTEM');


Reply With Quote
  #4  
Old   
Michael Maier
 
Posts: n/a

Default Re: Tables without primary key - 09-09-2004 , 03:12 PM



Hi,

thx a lot, i will try it tomorrow.


Best Regards,
Micha

Reply With Quote
  #5  
Old   
Pablo R
 
Posts: n/a

Default Re: Tables without primary key - 09-10-2004 , 06:10 PM



maier_michael2003 (AT) yahoo (DOT) de (Michael Maier) wrote in message news:<99f00224.0409091212.336e2937 (AT) posting (DOT) google.com>...
Quote:
Hi,

thx a lot, i will try it tomorrow.


Best Regards,
Micha
-------------------------------------------------

An easier and faster way to do it would be doing the following:


select owner,table_name from dba_tables
minus
select owner,table_name from dba_constraints
where constraint_type != 'P'

Pablo Rovedo
from Argentina


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.