Count the number of tables in the system and query the field information of all tables -- count the number of tables in the system: -- table description field: -- required field: Name, Code, Commente select lower (. TABLE_NAME) | '-' | B. comments, lower (. TABLE_NAME), B. comments from user_tables a, user_tab_comments B where. TABLE_NAME = B. TABLE_NAME order by B. comments,. TABLE_NAME; -- query the field information of all tables. -- Name, Code, Data Type, Length, P, F, comments select. table_name, t. comments,. COLUMN_ID, nvl (B. comments, B. column_name), B. column_name,. DATA_TYPE, case when. DATA_TYPE = 'varchar2' then. DATA_TYPE | '(' |. DATA_LENGTH | ')' when. DATA_TYPE = 'date' then'' when. DATA_TYPE = 'number' and. DATA_SCALE is not null then. DATA_TYPE | '(' |. DATA_PRECISION | ',' |. DATA_SCALE | ')' when. DATA_TYPE = 'number' and. DATA_SCALE is null then. DATA_TYPE | '(' |. DATA_LENGTH | ') 'else' end case, case when (select nvl (count (1), 0) from user_cons_columns c, user_constraints d where d. constraint_name = c. constraint_name and d. constraint_type = 'p' and c. table_name =. table_name and c. column_name =. column_name) = 1 then nvl (select d. constraint_name from user_cons_columns c, user_constraints d where d. constraint_name = c. constraint_name and d. constraint_type = 'p' and c. table_name =. table_name and c. column_name =. column_name), '') else'' end case from user_tab_cols a, user_col_comments B, user_tab_comments t where. TABLE_NAME = B. table_name and. COLUMN_NAME = B. column_name and. table_name = t. table_name order by. table_name,. COLUMN_ID;