Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Finding largest key in Oracle using SQL commands?

Re: Finding largest key in Oracle using SQL commands?

From: Jeff Smith <jsmit234_at_ford.com>
Date: Thu, 5 Dec 2002 08:55:03 -0500
Message-ID: <asnlrn$hmm5@eccws12.dearborn.ford.com>


I am not clear on "Finding largest key". You state "in the database" which makes me think you are talking about all tables. If you are talking about the largest number of columns in a primary key, maybe this will work:

select table_name, count(*)
from all_ind_columns
where index_name in (select constraint_name from all_constraints where constraint_type='P' )
group by table_name
order by count(*) desc

"Keith Lee" <cmarvel_at_nethere.com> wrote in message news:3ded6617.5876309_at_news.nethere.net...
> All:
> Does anyone know how to find the largest key in an Oracle database using
SQL commands? I could open use a
> PL/SQL procedure to loop through the table until I get to the largest key;
but, I was wondering if there was any SQL
> command to do this.
>
> Keith Lee
Received on Thu Dec 05 2002 - 07:55:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US