通过Oracle自带的一些表,导出所有表的表结构。
with temp as (select table_name name, '表' type, comments comments, '' tablename, 0 num, '' nullable from user_tab_comments where table_type = 'TABLE' union all select ' ' || a.column_name name, a.data_type || '(' || a.data_length || ')' type, b.comments comments, a.table_name tablename, column_id num, nullable nullable from user_tab_columns a, user_col_comments b where a.table_name = b.table_name and a.column_name = b.column_name) select name, type, nullable, comments from temp t start with tablename is null connect by prior t.name = t.tablename order siblings by num;