Oracle PL/SQL Tutorial/Table/comment — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 10:05, 26 мая 2010
Содержание
Add comment to a column
SQL>
SQL> create table salgrades
2 ( grade NUMBER(2)
3 , lowerlimit NUMBER(6,2)
4 , upperlimit NUMBER(6,2)
5 , bonus NUMBER(6,2)
6 ) ;
Table created.
SQL>
SQL>
SQL> comment on column salgrades.lowerlimit
2 is "For sales reps only";
Comment created.
SQL>
SQL> drop table salgrades;
Table dropped.
SQL>
Create comment for a table
SQL>
SQL> create table salgrades
2 ( grade NUMBER(2)
3 , lowerlimit NUMBER(6,2)
4 , upperlimit NUMBER(6,2)
5 , bonus NUMBER(6,2)
6 ) ;
Table created.
SQL>
SQL>
SQL>
SQL> comment on table salgrades
2 is "Salary grades and net bonuses";
Comment created.
SQL>
SQL> drop table salgrades;
Table dropped.
Query column comments through user_col_comments
SQL>
SQL> create table salgrades
2 ( grade NUMBER(2)
3 , lowerlimit NUMBER(6,2)
4 , upperlimit NUMBER(6,2)
5 , bonus NUMBER(6,2)
6 ) ;
Table created.
SQL>
SQL>
SQL> comment on column salgrades.bonus
2 is "For sales reps only";
Comment created.
SQL>
SQL>
SQL>
SQL> select comments
2 from user_col_comments
3 where table_name = "SALGRADES"
4 and column_name = "COMM";
no rows selected
SQL>
SQL> drop table salgrades;
Table dropped.
SQL>
SQL>
Query user_tab_comments to check the table comment
SQL>
SQL> create table salgrades
2 ( grade NUMBER(2)
3 , lowerlimit NUMBER(6,2)
4 , upperlimit NUMBER(6,2)
5 , bonus NUMBER(6,2)
6 ) ;
Table created.
SQL>
SQL>
SQL> comment on column salgrades.bonus
2 is "For sales reps only";
Comment created.
SQL>
SQL>
SQL> select comments
2 from user_tab_comments
3 where table_name = "SALGRADES";
COMMENTS
----------------------------------------------------------------------------------------------------
SQL>
SQL> drop table salgrades;
Table dropped.
SQL>