Cheap VPS host selection
Provide server host evaluation information

How does oracle query the structure of a table? Six methods for oracle to view the structure of a table

Method 1:

Enter in [Command Window], syntax: desc table name

 DESC DUAL;  --Or  DESCRIBE TB_STUDENT;

Note: You can use the command window in PLSQL Developer tool or enter commands in sqlplus in cmd. modb_20220703_5517f558-fa89-11ec-9935-38f9d3cd240d

 modb_20220703_55328ff8-fa89-11ec-9935-38f9d3cd240d

 

Method 2:

Enter the query table structure statement in the SQL window

 --Grammar  SELECT DBMS_METADATA. GET_DDL ('TABLE ',' table_name uppercase table name ') FROM DUAL;  --Example  SELECT DBMS_METADATA.GET_DDL('TABLE','TB_STUDENT') FROM DUAL;

Note: First, you must ensure that the target table belongs to the current login user, or the results will not be found; Second point, DBMS_METADATA.GET_DDL、TABLE、 Table names should be capitalized, otherwise an error will be reported.

 modb_20220703_5546e642-fa89-11ec-9935-38f9d3cd240d

 

Method 3:

Also, enter the script in the SQL window to query

 --Grammar  Select * from user_tab_columns where table_name='Upper case table name';  --Example  select * from user_tab_columns where table_name='TB_STUDENT';

 modb_20220703_555ee724-fa89-11ec-9935-38f9d3cd240d

Note: The target table must belong to the current login user and the table name must be in uppercase, otherwise no results can be found.

Method 4:

Similarly, enter a script in the SQL Window to query (TB_STUDENT) as the table name, and replace it when you need to query.

 select t.COLUMN_NAME,  decode(s.DATA_TYPE,  'DATE',  'DATE',  s.DATA_TYPE || '(' || s.DATA_LENGTH || ')'),  t.COMMENTS  from all_col_comments t, all_tab_columns s  where t.Table_Name = 'TB_STUDENT'  and s.Table_Name = 'TB_STUDENT'  and t.COLUMN_NAME = s.COLUMN_NAME  order by t.column_name;

 modb_20220703_55836bd0-fa89-11ec-9935-38f9d3cd240d

 

Method 5:

Use PLSQL Developer to write a query statement in SQL Window and execute it

 modb_20220703_559c146e-fa89-11ec-9935-38f9d3cd240d

 modb_20220703_55ac6bca-fa89-11ec-9935-38f9d3cd240d

 

Method 6:

Use the PLSQL Developer tool to view the graphical interface

 modb_20220703_55c035a6-fa89-11ec-9935-38f9d3cd240d

Do not reprint without permission: Cheap VPS evaluation » How does oracle query the structure of a table? Six methods for oracle to view the structure of a table