Oracle指定表导出结构至Excel

2022-12-02 09:32:15 浏览数 (1)

代码语言:javascript复制
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

AND A.OWNER = 'xxx' --用户名(区分大小写)

AND A.TABLE_NAME = 'xxx' --表名(区分大小写)

ORDER BY A.TABLE_NAME, B.COLUMN_ID;

按照自己需求修改查询内容即可,例如

选择导出至 excel file即可

0 人点赞