Managing Tables   «Prev  Next»

Lesson 6 Describing columns
Objective Gather information about the columns in a table.

Gathering Column Information from Oracle Data Dictionary Views

A core part of managing database objects in Oracle is understanding the structure of each table—its columns, data types, nullability rules, storage characteristics, and statistical properties. Oracle stores this metadata in data dictionary views, which provide a consistent and authoritative way to look inside your schema or across the entire database.

In Oracle 23c/23ai, data dictionary access continues to follow the same core pattern used in earlier releases: use USER_* views to inspect your own objects, ALL_* views to inspect objects you have privileges on, and DBA_* views for full administrative visibility. For table columns specifically, the most important view is USER_TAB_COLUMNS.

USER_TAB_COLUMNS – Core View for Column Metadata

USER_TAB_COLUMNS provides a detailed description of each column in the tables you own. The following list summarizes the most frequently used metadata elements:

TABLE_NAME The name of the table, matching the TABLE_NAME column in USER_TABLES.
COLUMN_NAME The name of the column within the table.
DATA_TYPE The Oracle data type, such as VARCHAR2, NUMBER, DATE, CLOB, BLOB, or BOOLEAN (23c).
DATA_LENGTH Maximum length of the column’s data representation, depending on data type.
CHAR_COL_DECL_LENGTH Declared character length for VARCHAR2, CHAR, and similar character columns.
DATA_PRECISION / DATA_SCALE Precision and scale of numeric columns.
NULLABLE Shows "N" if the column does not allow NULL values; otherwise "Y".

These fields allow you to reconstruct the logical structure of your table using only the metadata provided by Oracle’s catalog. They are foundational for schema analysis, report generation, automated code generation, and data governance.


Oracle Cloud Infrastructure

Column Statistics: USER_TAB_COL_STATISTICS

In addition to structural metadata, Oracle maintains column-level statistics in USER_TAB_COL_STATISTICS. These statistics are used by the Cost-Based Optimizer (CBO) to generate efficient execution plans.

Statistical metadata commonly includes:

Modern Oracle databases no longer use the old ANALYZE command for gathering statistics. Instead, statistics are collected automatically or manually using DBMS_STATS. This provides more accurate, efficient, and optimizer-friendly results.

Joining USER_TABLES and USER_TAB_COLUMNS

When gathering information about multiple tables, you often need to combine table-level and column-level metadata. The example below demonstrates joining USER_TABLES with USER_TAB_COLUMNS to list each table and its columns:


SELECT t.table_name,
       c.column_name
FROM   user_tables t
JOIN   user_tab_columns c
       ON t.table_name = c.table_name
ORDER  BY t.table_name, c.column_id;

This returns all tables owned by your user along with their columns, ordered in the same sequence as they appear in the table definition.

Additional Data Dictionary Views for Column Analysis

Beyond the basic views, Oracle provides other useful metadata sources:

These views allow you to perform everything from schema documentation to impact analysis during development or migration.

Mapping Table Characteristics Across Data Dictionary Views

TABLE_NAME Contains the name of the table.
AVG_ROW_LENGTH A column in the USER_TABLES view.
DATA_TYPE A column in the USER_TAB_COLUMNS view.
ALL_TABLES Lists tables in schemas accessible to the current user.
COLUMN_NAME The name of columns in USER_TAB_COLUMNS.
USER_TABLES Lists the tables in the current user's schema.

Object Name Thesaurus

A high-quality relational design extends beyond tables and columns—it requires a consistent object naming strategy. Many large organizations maintain naming standards and an object name thesaurus to ensure consistency and clarity across applications.

Whether you work with government agencies, enterprise systems, or internal development teams, using predictable naming conventions reduces ambiguity, improves code readability, and ensures smooth collaboration.

  1. Corporation
  2. Firm

If your organization does not provide naming standards, you should create guidelines that match the patterns shown throughout this module and apply them consistently.


SEMrush Software 6 SEMrush Banner 6