Re: Question about system tables
From: Paul Singleton <paul_at_cs.keele.ac.uk>
Date: 30 Nov 1993 15:20:49 -0000
Message-ID: <2dfoci$dau_at_sleepy.cs.keele.ac.uk>
Date: 30 Nov 1993 15:20:49 -0000
Message-ID: <2dfoci$dau_at_sleepy.cs.keele.ac.uk>
From article <8461.2cf9b7df_at_hayes.com>, by fgreene_at_hayes.com:
...
> to just count the columns in a table use
>
> SELECT COUNT(*)
> FROM ACCESSIBLE_TABLES
> WHERE TABLE_NAME = 'YOUR_TABLE_NAME';
This is incorrect: it returns a count of 1 for an accessible table,
0 otherwise.
If, instead, you select from ACCESSIBLE_COLUMNS, you get the 'degree' (i.e. the count of the columns) of the relation (table or view).
NB ACCESSIBLE_COLUMNS is not supported in Oracle7, so I suggest this, which oughta work in V6 or V7:
select count(distinct COLUMN_ID)
from ALL_TAB_COLUMNS
where TABLE_NAME = 'whatever';
----
__ __ Paul Singleton (Dr) JANET: paul_at_uk.ac.keele.cs
|__) (__ Computer Science Dept. other: paul_at_cs.keele.ac.uk
| . __). Keele University, Newcastle, tel: +44 (0)782 583477
Staffs ST5 5BG, ENGLAND fax: +44 (0)782 713082
Received on Tue Nov 30 1993 - 16:20:49 CET
