Roel Notebook

[ORACLE] 오라클 comment 추가/확인/수정/삭제 방법

by Roel Downey

DB

728x90
반응형

comment 설정

--테이블 Comment 설정
COMMENT ON TABLE [테이블명] IS [Comment];
COMMENT ON TABLE EX_TABLE IS '예제 테이블';

--컬럼 Comment 설정
COMMENT ON COLUMN [테이블명].[컬럼명] IS '[Comment]';
COMMENT ON COLUMN EX_TABLE.DEPT IS '부서';
COMMENT ON COLUMN EX_TABLE.TP IS '유형';

 

 

comment 확인

--테이블 전체 comment 조회
SELECT  table_name, table_type, comments FROM USER_TAB_COMMENTS WHERE comments IS NOT NULL; 

--컬럼 전체 comment 조회
SELECT table_name, column_name, comments FROM USER_COL_COMMENTS WHERE comments IS NOT NULL;

 

comment 수정, 삭제

--테이블 Comment 수정
COMMENT ON [테이블명] IS '수정내용';
COMMENT ON EX_TABLE IS '수정내용';

--컬럼 Comment 수정
COMMENT ON COLUMN [테이블명].[컬럼명] IS '수정내용'; 
COMMENT ON COLUMN EX_TABLE.DEPT IS '수정내용'; 

--테이블 Comment 삭제
COMMENT ON [테이블명] IS '';
COMMENT ON EX_TABLE IS '';

--컬럼 Comment 삭제
COMMENT ON COLUMN [테이블명].[컬럼명] IS ''; 
COMMENT ON COLUMN EX_TABLE.DEPT IS '';

 

 

 

728x90
반응형

블로그의 정보

What doing?

Roel Downey

활동하기