SELECT
t1.COLUMN_id AS "序号",
t3.comments AS "类别",
t2.Comments AS "属性",
t1.DATA_TYPE AS "类型",
t1.DATA_LENGTH AS "长度",
NVL(t1.data_scale, 0) AS "小数位数",
CASE WHEN t1.NullAble = 'N'
THEN '是'
ELSE '否' END AS "必填"
-- t1.Column_Name AS "字段名称",
--t1.Table_Name || chr(13) AS "表名称及说明"
--t4.created AS "建表时间"
FROM cols t1
LEFT JOIN user_col_comments t2
ON t1.Table_name = t2.Table_name
AND t1.Column_Name = t2.Column_Name
LEFT JOIN user_tab_comments t3
ON t1.Table_name = t3.Table_name
LEFT JOIN user_objects t4
ON t1.table_name = t4.OBJECT_NAME
WHERE NOT EXISTS (SELECT t4.Object_Name
FROM User_objects t4
WHERE t4.Object_Type = 'TABLE'
AND t4.Temporary = 'Y'
AND t4.Object_Name = t1.Table_Name)
AND t1.Table_Name LIKE '%YG_BS_M%'
ORDER BY t1.Table_Name, t1.Column_ID;
来源:CSDN
作者:Yang950831
链接:https://blog.csdn.net/Yang950831/article/details/103995323