Oracle导出所有表结构


通过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;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM