码迷,mamicode.com
首页 > 数据库 > 详细

oracle 导出数据字典

时间:2019-10-23 11:14:48      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:revenue   column   ||   line   tail   null   font   tom   and   

一、查看当前用户下表名,及表名的备注

select * from user_tab_comments where table_name like ‘T_ONLINE%‘

二、查询数据字典

1. 具有dba权限用户导出数据字典

 SELECT  A.TABLE_NAME AS "表名",A.COLUMN_NAME AS "字段名",
 DECODE(A.CHAR_LENGTH,0,DECODE(A.DATA_SCALE,NULL,A.DATA_TYPE,A.DATA_TYPE||‘(‘||A.DATA_PRECISION||‘,‘||A.DATA_SCALE||‘)‘),
 A.DATA_TYPE||‘(‘||A.CHAR_LENGTH||‘)‘) as "字段类型",A.DATA_DEFAULT AS "默认值",
A.NULLABLE AS "能否为空",B.comments AS "备注"
FROM sys.all_tab_columns A,sys.DBA_COL_COMMENTS B
WHERE A.owner=B.owner AND A.table_name=B.table_name  AND A.COLUMN_NAME=B.COLUMN_NAME AND A.owner=‘guoqiang‘  AND
A.TABLE_NAME IN (
‘TB_SUBJECT‘, ‘TB_SUBJECT_BALANCE‘, ‘TB_VOUCHER‘, ‘TB_VOUCHER_DETAILS‘, 
‘TB_CUSTOMER‘, ‘TB_VOUCHER_CLASSIFY_MODE‘, ‘TB_VOUCHER_TYPE‘, ‘TB_ASSET‘, 
‘TB_ASSET_CATALOG‘, ‘TB_M_DM_ASSETS_LIABI_RPT‘, ‘TB_M_DM_PROFIT_RPT‘, 
‘TB_M_DM_REVENUE_RPT‘, ‘TB_M_DM_COST_RPT‘
)
ORDER BY A.TABLE_NAME

 

2.一般用户导出该用户下的数据字典

 SELECT  A.TABLE_NAME AS "表名",A.COLUMN_NAME AS "字段名",
 DECODE(A.CHAR_LENGTH,0,DECODE(A.DATA_SCALE,NULL,A.DATA_TYPE,A.DATA_TYPE||‘(‘||A.DATA_PRECISION||‘,‘||A.DATA_SCALE||‘)‘),
 A.DATA_TYPE||‘(‘||A.CHAR_LENGTH||‘)‘) as "字段类型",A.DATA_DEFAULT AS "默认值",
A.NULLABLE AS "能否为空",B.comments AS "备注"
FROM sys.user_tab_columns A,sys.user_col_comments B
WHERE A.table_name=B.table_name  AND A.COLUMN_NAME=B.COLUMN_NAME AND
A.TABLE_NAME IN (
‘TB_SUBJECT‘, ‘TB_SUBJECT_BALANCE‘, ‘TB_VOUCHER‘, ‘TB_VOUCHER_DETAILS‘, 
‘TB_CUSTOMER‘, ‘TB_VOUCHER_CLASSIFY_MODE‘, ‘TB_VOUCHER_TYPE‘, ‘TB_ASSET‘, 
‘TB_ASSET_CATALOG‘, ‘TB_M_DM_ASSETS_LIABI_RPT‘, ‘TB_M_DM_PROFIT_RPT‘, 
‘TB_M_DM_REVENUE_RPT‘, ‘TB_M_DM_COST_RPT‘
)
ORDER BY A.TABLE_NAME

oracle 导出数据字典

标签:revenue   column   ||   line   tail   null   font   tom   and   

原文地址:https://www.cnblogs.com/52KT9/p/11725033.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!