1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 아래 쿼리를 활용하시면 comment사항을 활용하실수 있을겁니다. 여러가지로 활용가능한 쿼리입니다. 참조하세요... 테이블 owner명과, 테이블명을 입력하시고... 그리고 comment 사항이 잘 정리되어 있다면 활용가능하리라 생각됩니다. SELECT DECODE( 'U' , 'L' , Lower (ALLTAB.COLUMN_NAME), 'U' , Upper (ALLTAB.COLUMN_NAME), CASE WHEN INSTR(ALLTAB.COLUMN_NAME, '_' ) > 0 THEN Lower (SUBSTR(ALLTAB.COLUMN_NAME,1,INSTR(ALLTAB.COLUMN_NAME, '_' ) -1)) || REPLACE (INITCAP( REPLACE (SUBSTR( Lower (ALLTAB.COLUMN_NAME), INSTR(ALLTAB.COLUMN_NAME, '_' )), '_' , ' ' )), ' ' , '' ) ELSE LOWER (ALLTAB.COLUMN_NAME) END ) COLUMN_NAME, RPAD(( CASE WHEN ALLTAB.DATA_TYPE = 'NUMBER' THEN ALLTAB.DATA_TYPE || DECODE(NVL( ALLTAB.DATA_PRECISION, 0 ), 0, '' , '(' || ALLTAB.DATA_PRECISION || ',' || ALLTAB.DATA_SCALE || ')' ) WHEN ALLTAB.DATA_TYPE = 'CHAR' THEN 'VARCHAR2(' || ALLTAB.CHAR_COL_DECL_LENGTH || ')' WHEN ALLTAB.DATA_TYPE IN ( 'DATE' , 'DATETIME' ) THEN ALLTAB.DATA_TYPE || ALLTAB.CHAR_COL_DECL_LENGTH WHEN ALLTAB.DATA_TYPE IN ( 'CLOB' , 'BLOB' ) THEN ALLTAB.DATA_TYPE WHEN ALLTAB.DATA_TYPE IN ( 'LONG' ) THEN ALLTAB.DATA_TYPE ELSE ALLTAB.DATA_TYPE || '(' || ALLTAB.CHAR_COL_DECL_LENGTH || ')' END ), 15, ' ' ) DATA_TYPE, RPAD(( CASE WHEN ALLTAB.NULLABLE = 'N' THEN 'NN' WHEN ALLTAB.NULLABLE = 'Y' THEN ' ' END ), 15, ' ' ) NULL_INDC, RPAD(( SELECT NVL(TABLESPACE_NAME, 'TS_XXXXXXXXXX' ) TABLESPACE_NAME FROM SYS.ALL_TABLES WHERE TABLE_NAME = ALLTAB.TABLE_NAME AND OWNER = ALLTAB.OWNER), 15, ' ' ) TBL_SPACE, ALLTAB.DATA_DEFAULT DFLT_VALUE, ALLCOL.COMMENTS, ALLTAB.COLUMN_ID , NVL(( SELECT DECODE(SUBSTR(INDEX_NAME,1,2), 'PK' , 'Y' , 'N' ) FROM ALL_IND_COLUMNS WHERE TABLE_OWNER = ALLTAB.OWNER AND TABLE_NAME = ALLTAB.TABLE_NAME AND COLUMN_NAME = ALLTAB.COLUMN_NAME AND INDEX_NAME LIKE 'PK%' ), 'N' ) PK_INDC FROM SYS.ALL_TAB_COLUMNS ALLTAB, SYS.ALL_COL_COMMENTS ALLCOL WHERE ALLTAB.OWNER = 'SNCNSONE' -----------------> owner명 AND ALLTAB.TABLE_NAME = 'RA010M' ------------------> 테이블명 AND ALLTAB.OWNER = ALLCOL.OWNER AND ALLTAB.TABLE_NAME = ALLCOL.TABLE_NAME AND ALLTAB.COLUMN_NAME= ALLCOL.COLUMN_NAME |