Oracle system views User_tab_cols and User_tab_columns

Source: Internet
Author: User

Views Sys.user_tab_cols and Sys.user_tab_columns all save the current user's tables, views, and
The column information in the clusters. By retrieving these two tables, you can easily get to the structure of the table.

The main column properties are:
table_name
Table, view, or clusters name
column_name
Column Name
Data_type
Data type
Data_type_mod
Datatype modifier of the column
Data_type_owner
Owner of the datatype of the column
Data_length
Length
Data_precision
Precision
Data_scale
Number of digits after the decimal point
NULLABLE
Whether to allow empty
column_id
Column ID
Default_length
Default value length
Data_default
Default value
Char_length
The maximum number of columns, represented by a string

The difference is that User_tab_cols is a few more columns than User_tab_columns:

Hidden_column VARCHAR2 (3)
Virtual_column VARCHAR2 (3)
SEGMENT_COLUMN_ID number
internal_column_id not NULL number
Qualified_col_name VARCHAR2 (4000)

And there are more hidden fields stored in the content. These hidden fields are automatically added by Oracle and set
Both Hidden_column and Virtual_column are yes.

Look at Oracle's script to discover that the view User_tab_columns is created from the view User_tab_cols:
Create or replace view Sys.user_tab_columns as
Select table_name, COLUMN_NAME, Data_type, Data_type_mod, Data_type_owner,
Data_length, Data_precision, Data_scale, NULLABLE, column_id,
Default_length, Data_default, num_distinct, Low_value, High_value,
DENSITY, Num_nulls, Num_buckets, last_analyzed, Sample_size,
Character_set_name, Char_col_decl_length,
Global_stats, User_stats, Avg_col_len, Char_length, char_used,
V80_fmt_image, data_upgraded
From User_tab_cols
where hidden_column = ' NO '

Use User_tab_columns as much as possible to avoid acquiring hidden fields that Oracle adds to itself.

Oracle system views User_tab_cols and User_tab_columns

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.