Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Finding largest key in Oracle using SQL commands?
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