Computer_IT/DBMS 2018.08.08 14:42

-- 테이블 COMMENT 조회

SELECT TABLE_NAME, TABLE_TYPE, COMMENTS 

FROM USER_TAB_COMMENTS

WHERE COMMENTS IS NOT NULL;


-- 컬럼별 COMMENT 조회

SELECT * 

FROM USER_COL_COMMENTS

WHERE COMMENTS IS NOT NULL;


-- 테이블별 COMMENT 쿼리문

SELECT 'COMMENT ON TABLE ' || TABLE_NAME || ' IS ''' || COMMENTS || ''';' 

FROM USER_TAB_COMMENTS

WHERE COMMENTS IS NOT NULL;

COMMENT ON TABLE TABLE_NAME IS 'COMMENTS text';


-- 컬럼별 COMMENT 쿼리문

SELECT 'COMMENT ON COLUMN ' || TABLE_NAME || '.' || COLUMN_NAME || ' IS ''' ||  COMMENTS || ''';' 

FROM USER_COL_COMMENTS 

WHERE COMMENTS IS NOT NULL;

COMMENT ON COLUMN TABLE_NAME.COLUMN_NAME IS 'COMMENTS';



posted by 고급코드 고급코드