Oracle 视图 ALL_TAB_COLS 官方解释,作用,如何使用详细说明
本站中文解释
Oracle视图ALL_TAB_COLS是一个多表视图,其中用于存储用户在Oracle数据库中拥有的表、表列和索引的元数据信息。
此视图可以帮助用户快速了解Oracle数据库中正在使用的表列名称、表空间、占用空间大小等信息,从而成功实施数据库管理项目。
使用视图ALL_TAB_COLS的方法如下:
1、查询一个表的全部列:
SELECT * FROM ALL_TAB_COLS WHERE TABLE_NAME=’TABLE_NAME’;
2、查询一个表的指定列信息:
SELECT * FROM ALL_TAB_COLS WHERE TABLE_NAME=’TABLE_NAME’ AND COLUMN_NAME=’COLUMN_NAME’;
3、按照表中列名排序:
SELECT * FROM ALL_TAB_COLS WHERE TABLE_NAME=’TABLE_NAME’ ORDER BY COLUMN_NAME;
4、查询用户拥有的每个表的索引列:
SELECT TABLE_NAME,UNIQUENESS,COLUMN_NAME,INDEX_NAME,COLUMN_LENGTH
FROM ALL_TAB_COLS WHERE TABLE_NAME IN (SELECT TABLE_NAME
FROM ALL_TABLES WHERE OWNER=’your_owner’) AND INDEX_NAME IS NOT NULL;
官方英文解释
ALL_TAB_COLS describes the columns of the tables, views, and clusters accessible to the current user.
To gather statistics for this view, use the DBMS_STATS package.
This view differs from ALL_TAB_COLUMNS in that system-generated hidden columns are not filtered out.
Related Views
DBA_TAB_COLSdescribes the columns of all tables, views, and clusters in the database.USER_TAB_COLSdescribes the columns of the tables, views, and clusters owned by the current user. This view does not display theOWNERcolumn.
| Column | Datatype | NULL | Description |
|---|---|---|---|
|
|
| Owner of the table, view, or cluster |
|
|
| Name of the table, view, or cluster |
|
|
| Column name |
|
| Data type of the column | |
|
| Data type modifier of the column | |
|
| Owner of the data type of the column | |
|
|
| Length of the column (in bytes) |
|
| Decimal precision for | |
|
| Digits to the right of the decimal point in a number | |
|
| Indicates whether a column allows NULLs. The value is | |
|
| Sequence number of the column as created | |
|
| Length of the default value for the column | |
|
| Default value for the column | |
|
| Number of distinct values in the column. This column remains for backward compatibility with Oracle7. This information is now in the | |
|
| Low value in the column. This column remains for backward compatibility with Oracle7. This information is now in the | |
|
| High value in the column. This column remains for backward compatibility with Oracle7. This information is now in the | |
|
| If a histogram is available on If a histogram is not available on This column remains for backward compatibility with Oracle7. This information is now in the | |
|
| Number of NULLs in the column | |
|
| Number of buckets in the histogram for the column Note: The number of buckets in a histogram is specified in the | |
|
| Date on which this column was most recently analyzed | |
|
| Sample size used in analyzing this column | |
|
| Name of the character set:
| |
|
| Declaration length of the character type column | |
|
|
| |
|
| Indicates whether statistics were 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:
| |
|
| Indicates that the column uses
| |
|
| Indicates whether the column data is in release 8.0 image format ( | |
|
| Indicates whether the column data has been upgraded to the latest type version format ( | |
|
| Indicates whether the column is a hidden column ( | |
|
| Indicates whether the column is a virtual column ( | |
|
| Sequence number of the column in the segment | |
|
|
| Internal sequence number of the column |
|
| Indicates existence/type of histogram:
| |
|
| Qualified column name | |
|
| Indicates whether the column is a user-generated column ( Invisible columns are hidden columns that are also user- generated columns. | |
|
| Indicates whether the column has DEFAULT ON NULL semantics ( | |
|
| Indicates whether this is an identity column ( | |
|
| Name of the edition in which editioned objects referenced in an expression column are resolved | |
|
| Name of the oldest edition in which the column is usable | |
|
| Name of the oldest edition in which the column becomes perpetually unusable | |
|
| Collation for the column. Only applies to columns with character data types. | |
|
| Internal sequence number of a column, for which this virtual column generates a collation key. |
See Also:
“DBA_TAB_COLS”
“USER_TAB_COLS”
“ALL_TAB_COLUMNS”
Oracle Database PL/SQL
Packages and Types Reference for more information about theDBMS_STATSpackage
