--Query field name, field type, field comment Select dd.*, EE. Constraint_type from (SELECT t.column_id, T.column_name, (case when (t.data_t YPE = ' VARCHAR2 ' OR t.data_type = ' RAW ' then T.data_type | | ' (' | | T.data_length | | ') ' When (T.data_type = ' number ' and t.data_precision are not NULL) then T.data_type | | ' (' | | t.data_precision | | ', ' | | T.data_scale | | ' ELSE t.data_type END) as Data_type, B.comments, T.nullable from User_tab_columns T INNER joins all_col_comments B on b.column_name = T.col Umn_name and t.table_name = b.table_name and T.table_name = UPPER (' t_article ')) DD left JOIN (SELECT Wm_concat (CC. Constraint_type) as Constraint_type, CC. column_name from (SELECT a.column_name, A.owner, A.table_name, B.constraint_type from User_cons_columNS A, user_constraints B WHERE a.constraint_name = b.constraint_name--and b.constraint_type = ' P ' an D a.table_name = UPPER (' t_article ')) cc GROUP by CC. column_name) EE on EE. COLUMN_NAME = DD. column_name ORDER by DD. column_id;--query Table Comments Select T.table_name, t.comments, t.table_type from user_tab_comments t;--querying table field constraints (select Wm_concat (CC . Constraint_type) as Constraint_type, CC. COLUMN_NAME, CC. OWNER, CC. table_name from (SELECT a.column_name, A.owner, A.table_name, b.constraint_type from User_cons_columns A, US Er_constraints B WHERE a.constraint_name = b.constraint_name--and b.constraint_type = ' P ' and a.tabl E_name = ' T_weixin_remind_fund_change ') cc GROUP by CC. COLUMN_NAME, CC. OWNER, CC. TABLE_NAME)
Oracle query Table structure