Oacle comment 명령 용법 예제 공유

2965 단어 comment 명령
Oacle 에서 comment on 명령 으로 표 나 필드 에 설명 합 니 다.문법 은 다음 과 같 습 니 다.
용법 은 다음 과 같다.
1.표 에 대한 설명

COMMENT ON
  { TABLE [ schema. ]
    { table | view }
  | COLUMN [ schema. ]
    { table. | view. | materialized_view. } column
  | OPERATOR [ schema. ] operator
  | INDEXTYPE [ schema. ] indextype
  | MATERIALIZED VIEW materialized_view
  }
IS 'text' ;
2.표 에 열 거 된 설명

comment on table table_name is 'comments_on_tab_information';
3.표 의 설명 보기

comment on column table.column_name is 'comments_on_col_information';

SQL> select * from user_tab_comments where TABLE_NAME='EMPLOYEES';
4.표 에 열 거 된 설명 보기

TABLE_NAME                     TABLE_TYPE  COMMENTS
------------------------------ ----------- ----------
EMPLOYEES                      TABLE      

SQL> select * from user_tab_comments where comments is not null;

TABLE_NAME                     TABLE_TYPE  COMMENTS
------------------------------ ----------- --------------------------
EMPLOYEES                      TABLE      


SQL> select * from user_col_comments where TABLE_NAME='EMPLOYEES';
5.우 리 는 아래 의 보기 에서 표 급 과 열 급 설명 을 볼 수 있다

TABLE_NAME                     COLUMN_NAME                    COMMENTS
------------------------------ ------------------------------ ------------
EMPLOYEES                      EMPLOYEE_ID                   
EMPLOYEES                      MANAGER_ID                    
EMPLOYEES                      FIRST_NAME                    
EMPLOYEES                      LAST_NAME                     
EMPLOYEES                      TITLE                         
EMPLOYEES                      SALARY                        


SQL> select * from user_col_comments where comments is not null;

TABLE_NAME                     COLUMN_NAME                    COMMENTS
------------------------------ ------------------------------ -------------
EMPLOYEES                      SALARY                        

6.표 급 설명 삭제,즉 비 워 두 기

ALL_COL_COMMENTS
USER_COL_COMMENTS
ALL_TAB_COMMENTS
USER_TAB_COMMENTS
7.열 급 설명 을 삭제 하 는 것 도 비어 있 습 니 다

SQL> comment on table employees is '';
Comment added

SQL> select * from user_tab_comments where TABLE_NAME='EMPLOYEES';

TABLE_NAME                     TABLE_TYPE  COMMENTS
------------------------------ ----------- -------------
EMPLOYEES                      TABLE     

좋은 웹페이지 즐겨찾기