【推荐】Oracle导出所有表结构

【背景说明】

最近在帮同事维护OA系统,需要查看Oracle数据库的所有表结构,又不想一个一个表的导出建表语句。搜到这个,于是和大家分享一下:)

 

【Oracle导出所有表结构SQL】

说明:此SQL语句是通用的,直接可以拿来用,爽!当然若有额外需求,请根据实际情况修改

 

SELECT B.TABLE_NAME     AS "表名", 
       C.COMMENTS       AS "表说明", 
       B.COLUMN_ID      AS "字段序号", 
       B.COLUMN_NAME    AS "字段名", 
       B.DATA_TYPE      AS "字段数据类型", 
       B.DATA_LENGTH    AS "数据长度", 
       B.DATA_PRECISION AS "整数位", 
       B.DATA_SCALE     AS "小数位", 
       A.COMMENTS       AS "字段说明" 
  FROM ALL_COL_COMMENTS A, ALL_TAB_COLUMNS B, ALL_TAB_COMMENTS C 
WHERE A.TABLE_NAME IN (SELECT U.TABLE_NAME FROM USER_ALL_TABLES U) 
   AND A.OWNER = B.OWNER 
   AND A.TABLE_NAME = B.TABLE_NAME 
   AND A.COLUMN_NAME = B.COLUMN_NAME 
   AND C.TABLE_NAME = A.TABLE_NAME 
   AND C.OWNER = A.OWNER 
ORDER BY A.TABLE_NAME, B.COLUMN_ID 

(全文完)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值