all_col_commentsテーブルに、このテーブルの列に対するテーブルとコメントがあります。テーブルの列名の代わりに、選択クエリの all_col_comments から列コメントを出力するにはどうすればよいですか?
例:
SELECT column1 AS 'comment for column1 from all_col_comments table'
, column2 AS 'comment for column2 from all_col_comments table',
FROM my_table;
質問 V2やりたいこと
SQL> create table myTable(
2 id NUMBER(2),
3 value NUMBER(6,2)
4 )
5 /
Table created.
SQL>
SQL> -- prepare data
SQL> insert into myTable(ID, value)values (1,9)
2 /
1 row created.
SQL> insert into myTable(ID, value)values (2,2.11)
2 /
1 row created.
SQL>
SQL> select * from myTable
2 /
ID VALUE
---------- ----------
1 9
2 2.11
2 rows selected.
SQL>
SQL> COMMENT ON COLUMN myTable.id IS
2 'id stores the id';
Comment created.
SQL> COMMENT ON COLUMN myTable.value IS
2 'value stores the some comment for value';
Comment created.
次に、いくつかの選択を行ってこれを取得する必要があります
SQL>
SQL> select ??? ...
id stores the id value stores the some comment for value
---------- ----------
1 9
2 2.11
2 rows selected.