我在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.