1. 程式人生 > >匯出表結構到Excel 生成程式碼用

匯出表結構到Excel 生成程式碼用

 

匯出表結構到Excel ,統一維護,生成程式碼用

SELECT C.TABLE_NAME,CC.COMMENTS,C.COLUMN_NAME,C.DATA_TYPE, CASE WHEN C.DATA_TYPE='NUMBER' THEN C.DATA_PRECISION ELSE C.CHAR_LENGTH END AS DATA_LENGTH ,C.DATA_SCALE, C.NULLABLE FROM USER_TAB_COLUMNS C 
LEFT JOIN USER_COL_COMMENTS CC ON CC.TABLE_NAME=C.TABLE_NAME AND
CC.COLUMN_NAME=C.COLUMN_NAME WHERE EXISTS (SELECT 1 FROM USER_TABLES T WHERE C.TABLE_NAME=T.TABLE_NAME AND T.TABLE_NAME LIKE 'ELB%') ORDER BY C.TABLE_NAME,c.COLUMN_ID