This content has been marked as final. Show 3 replies
Query table: ALL_TAB_COLUMNS.
ALL_TAB_COLUMNS describes the columns of the tables, views, and clusters accessible to the current user. To gather statistics for this view, use the SQL ANALYZE statement or the DBMS_STATS package.
DBA_TAB_COLUMNS describes the columns of all tables, views, and clusters in the database.
USER_TAB_COLUMNS describes the columns of the tables, views, and clusters owned by the current user. This view does not display the OWNER column.
Column Datatype NULL Description
Owner of the table, view, or cluster
Name of the table, view, or cluster
Datatype of the column
Datatype modifier of the column
Owner of the datatype of the column
Length of the column in bytes
Decimal precision for NUMBER datatype; binary precision for FLOAT datatype, null for all other datatypes
Digits to right of decimal point in a number
Specifies whether a column allows NULLs. Value is N if there is a NOT NULL constraint on the column or if the column is part of a PRIMARY KEY.
Sequence number of the column as created
Length of default value for the column
Default value for the column
These columns remain for backward compatibility with Oracle7. This information is now in the TAB_COL_STATISTICS views. This view now picks up these values from HIST_HEAD$ rather than COL$.
Number of nulls in the column
The number of buckets in histogram for the column
Note: The number of buckets in a histogram is specified in the SIZE parameter of the SQL statement ANALYZE. However, Oracle does not create a histogram with more buckets than the number of rows in the sample. Also, if the sample contains any values that are very repetitious, Oracle creates the specified number of buckets, but the value indicated by this column may be smaller because of an internal compression algorithm.
The date on which this column was most recently analyzed
The sample size used in analyzing this column
The name of the character set: CHAR_CS or NCHAR_CS
For partitioned tables, indicates whether column statistics were collected for the table as a whole (YES) or were estimated from statistics on underlying partitions and subpartitions (NO).
Were the statistics entered directly by the user?
Average length of the column (in bytes)
Displays the length of the column in characters. This value only applies to the following datatypes:
B | C. B indicates that the column uses BYTE length semantics. C indicates that the column uses CHAR length semantics. NULL indicates the datatype is not any of the following:
Keep it simple. If you own the table:
select column_name from user_tab_columns
where table_name = 'YOUR TABLE NAME HERE';
If you don't own the table but were granted access to it:
select column_name from all_tab_columns
where owner = 'TABLE OWNER HERE'
and table_name = 'YOUR TABLE NAME HERE';