查询表结构
SELECT T.COLUMN_ID, T.COLUMN_NAME, (CASE WHEN (T.DATA_TYPE = ‘VARCHAR2‘ OR T.DATA_TYPE = ‘RAW‘) THEN T.DATA_TYPE || ‘(‘ || T.DATA_LENGTH || ‘)‘ WHEN (T.DATA_TYPE = ‘NUMBER‘ AND T.DATA_PRECISION IS NOT NULL) THEN T.DATA_TYPE || ‘(‘ || T.DATA_PRECISION || ‘,‘ || T.DATA_SCALE || ‘)‘ ELSE T.DATA_TYPE END) AS DATA_TYPE, B.COMMENTS FROM USER_TAB_COLUMNS T INNER JOIN ALL_COL_COMMENTS B ON B.COLUMN_NAME = T.COLUMN_NAME AND T.TABLE_NAME = B.TABLE_NAME AND T.TABLE_NAME = ‘T_WEIXIN_REMIND_FUND_CHANGE‘ ORDER BY T.COLUMN_ID;
第二种:红色部分可以把 T.DATA_TYPE 字段移动到CASE,WHEN 之间,这样when之后就直接写DATA_TYPE对应的值即可
时间: 2024-10-11 11:49:39