首页 > 解决方案 > Why can't I see comment on column?

问题描述

I Can't see comment on column.

I think everything is done well, but I don't get what I want

create table TRANSAKCIJE (
tx_id number generated by default as identity,
acc_id number,
tx_date date,
tx_iznos number,

constraint fk_accounts
foreign key(acc_id)
references accounts(acc_id)
);                    

comment on column transakcije.tx_id 
is 'This is transaction ID';

comment on column transakcije.acc_id
is 'This is accounts ID';

comment on column transakcije.tx_date
is 'This is transaction DATE';

comment on column transakcije.tx_iznos
is 'This is transaction AMOUNT';

commit;

desc transakcije;

I got this output:

Name     Null?    Type   
-------- -------- ------ 
TX_ID    NOT NULL NUMBER 
ACC_ID            NUMBER 
TX_DATE           DATE   
TX_IZNOS          NUMBER

标签: sqloracleddl

解决方案


You need to query Data Dictionary view USER_COL_COMMENTS to display comments on the columns of the tables and views owned by the current user, such as using

select column_name, comments
  from user_col_comments
 where table_name = 'TRANSAKCIJE'

If you need comments added directly on tables you can use USER_TAB_COMMENTS

Demo


推荐阅读