You can use the table name and field name to query the field type.
Today, I encountered a problem: I want to obtain the field type of this field through the table name and field name. I found a lot of methods on the Internet, but I was not successful (my database knowledge is scarce ). Later, I found a correct statement, which is recorded here.
Select data_type from user_tab_columns where table_name = 'table name' and column_name = 'field name'
How to find the table name
Select a. name table name, B. name column name
From sysobjects a, syscolumns B
Where a. id = B. id
And B. name = 'field name'
And a. type = 'U'
How can I query the field types, field comments, and field names in an oracle table?
You can use the following statement:
SELECT B. column_name -- field name
, B. data_type -- field type
, B. data_length -- Field Length
, A. comments -- field comment
FROM user_col_comments
, All_tab_columns B
WHERE a. table_name = B. table_name and
A. table_name = 'table _ name ';
PS:
Table_name is case sensitive.