The following articles mainly introduce the content of the Oracle query table name and table column name, as well as the code of its actual application, if you have a desire to understand the relevant content of this article, the following describes the specific content of this article. I hope you will gain some benefits.
1. query Table Name:
Copy the Code as follows:
- Select table_name, tablespace_name,
Temporary from user_tables [where table_name = table name]
Where: table_name: Table Name varchar2 (30 ));
- Tablespace_name: The tablespace that stores the table name varchar230 ));
Temporary: whether it is a temporary table varchar21 )).
- eg: select table_name,tablespace_name,
temporary from user_tables where table_name='TEST_TEMP';
Result:
- --------------------------------------------------------------------------------
- table_name tablespace_name temporary
- TEST_TEMP SDMP N
- --------------------------------------------------------------------------------
Note: The table name variable value must be capitalized.
2. query the Oracle table column Name:
Copy the Code as follows:
- Select column_name, data_type,
Data_length, data_precision, data_scale from user_tab_columns [where table_name = table name];
Where: column_name: column name varchar2 (30 ));
Data_type: column data type varchar2 (106 ));
Data_length: column length number );
- eg:select column_name,data_type ,
data_length,data_precision,data_scale from user_tab_columns where table_name='TEST_TEMP';
Result:
- --------------------------------------------------------------------------------
- column_name data_type data_length data_precision data_scale
- ID NUMBER 22 0
- NAME NVARCHAR2 20
- SEX CHAR 1
- GRADE NVARCHAR2 10
- --------------------------------------------------------------------------------
Note: The table name variable value must be capitalized.
In addition, you can use all_tab_columns to obtain the data of the relevant table.
- eg:select * from all_tab_columns where table_name='TEST_TEMP';
The above content is an introduction to the Oracle query table name and table column name. I hope you will have some gains.