如何在SQL中检索或读取特定列的注释

时间:2015-04-07 09:21:51

标签: sql oracle oracle11g

我为列

添加了一些注释
 COMMENT ON COLUMN STUDENT.STUDENT_NAME
 IS 'This is comment for the column';

 COMMENT on column student.student_name 'THIS IS COMMENT FOR THE COLUMN' succeeded.

如何使用查询查看?

2 个答案:

答案 0 :(得分:3)

据推测,您使用的是ORACLE RDBMS。在这种情况下,您可以使用user_col_comments系统视图:

SELECT comments
FROM user_col_comments
WHERE TABLE_NAME = 'STUDENT' AND COLUMN_NAME = 'STUDENT_NAME'

SQL Fiddle Demo

答案 1 :(得分:0)

你试过这个:

select * from user_tab_comments where table_name='STUDENT'

或者这个:

select * from all_tab_comments where table_name='STUDENT'