ORACLE - 注释所有表的所有列

时间:2015-05-27 17:48:01

标签: sql oracle

我想评论列中有Foreing键的所有表的所有列以及一个特定的表。

我逐一了解评论,但他们是很多领域

1 个答案:

答案 0 :(得分:1)

SELECT
'COMMENT ON COLUMN ' as command1,
SYS.ALL_TAB_COLUMNS.OWNER,
'.' as command2,
SYS.ALL_TAB_COLUMNS.TABLE_NAME,
'.' as command3,
SYS.ALL_TAB_COLUMNS.COLUMN_NAME,
' is ''@Enumeration=boleano' as coment_to_add,
SYS.ALL_COL_COMMENTS.COMMENTS,
''';' as command5
FROM
SYS.ALL_TAB_COLUMNS
INNER JOIN SYS.ALL_COL_COMMENTS ON SYS.ALL_TAB_COLUMNS.COLUMN_NAME = SYS.ALL_COL_COMMENTS.COLUMN_NAME AND SYS.ALL_TAB_COLUMNS.TABLE_NAME = SYS.ALL_COL_COMMENTS.TABLE_NAME AND SYS.ALL_TAB_COLUMNS.OWNER = SYS.ALL_COL_COMMENTS.OWNER
WHERE
SYS.ALL_TAB_COLUMNS.OWNER LIKE '$MY_OWNER'

导出到txt文件的结果是脚本;