SELECT a.column_name,
c.comments AS column_name_ko,
CASE
WHEN data_type = 'VARCHAR2' THEN 'VC2'
WHEN data_type = 'NUMBER' THEN 'NUM'
ELSE data_type
END
|| '(' || data_length || ')' AS TYPE,
b.key,
nullable,
data_default AS defalut,
c.comments
FROM cols a
LEFT OUTER JOIN ( SELECT table_name, COLUMN_NAME, 'PK' AS KEY
FROM ALL_CONS_COLUMNS
WHERE CONSTRAINT_NAME IN
(SELECT CONSTRAINT_NAME
FROM ALL_CONSTRAINTS
WHERE CONSTRAINT_TYPE = 'P'
AND table_name = 'EMPLOYEES') --파라미터
ORDER BY TABLE_NAME, POSITION) b
ON a.table_name = b.table_name AND a.column_name = b.column_name
LEFT OUTER JOIN (SELECT column_name, comments
FROM USER_COL_COMMENTS
WHERE table_name = 'EMPLOYEES') c --파라미터
ON a.column_name = c.column_name
WHERE a.table_name = 'EMPLOYEES' --파라미터
ORDER BY column_id