Oracle使用之----导出数据字典

更新时间:2023-07-28 12:56:43 阅读: 评论:0

Oracle使⽤之----导出数据字典⼀、查看当前⽤户下表名,及表名的备注
SELECT * FROM USER_TAB_COMMENTS WHERE TABLE_NAME LIKE 'WEB_PLY_BASE%'; SELECT * FROM DBA_TAB_COMMENTS WHERE TABLE_NAME LIKE 'WEB_PLY_BASE%';⼆、查询数据库某表字段
SELECT WM_CONCAT(COLUMN_NAME)
FROM USER_TAB_COLS@LINK_CORE
WHERE TABLE_NAME = UPPER('T_WEB_PLY_BASE')
ORDER BY COLUMN_ID;
SELECT WM_CONCAT(COLUMN_NAME)
FROM DBA_TAB_COLS@LINK_CORE
WHERE TABLE_NAME = UPPER('WEB_PLY_BASE')
AND OWNER = 'ZSSYS'
ORDER BY COLUMN_ID;
三、查询数据字典
-- 1. 查询某表的数据字典
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 "字段类型1",
A.DATA_TYPE AS "字段类型",
A.DATA_PRECISION AS "有效位",
A.DATA_SCALE AS "精度值",
A.CHAR_LENGTH AS "字段长度",
A.NULLABLE AS "能否为空"
FROM sys.ur_tab_columns A
where A.table_name = 'TAM_ADDRESS';
-- 2. 具有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 "能否为空",
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;
-- 3.⼀般⽤户导出该⽤户下的数据字典
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 "能否为空",
FROM sys.ur_tab_columns A, sys.ur_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;
-----使⽤下⾯语句从all_constraints视图中查看某表上的约束:
SELECT constraint_name, table_name, r_owner, r_constraint_name FROM all_constraints WHERE table_name = 'TBL_ORGAN_SALES' and owner = 'ZSWX';

本文发布于:2023-07-28 12:56:43,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1121655.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:数据   字典   查看   表名   导出   游戏
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图