ORCALE
生成所有表的备注脚本
SELECT
'COMMENT ON TABLE "' || TABLE_NAME || '" IS ''' || COMMENTS || ''';' AS "生成备注脚本"
FROM
USER_TAB_COMMENTS
WHERE
COMMENTS IS NOT NULL;
生成所有列的备注脚本
SELECT
'COMMENT ON TABLE "' || t.TABLE_NAME || '" IS ''' || t.COMMENTS || ''';' AS "表备注脚本",
'COMMENT ON COLUMN "' || t.TABLE_NAME || '"."' || c.COLUMN_NAME || '" IS ''' || c.COMMENTS || ''';' AS "列备注脚本"
FROM
USER_TAB_COMMENTS t
JOIN
USER_COL_COMMENTS c ON t.TABLE_NAME = c.TABLE_NAME
WHERE
t.COMMENTS IS NOT NULL OR c.COMMENTS IS NOT NULL
ORDER BY
t.TABLE_NAME, c.COLUMN_NAME;