--COL_NAME字段名,COL_TYPE字段类型,COL_COMMENT字段含义;--tableName表名,userName用户名;SELECT
C.COLUMN_NAME COL_NAME,
C.DATA_TYPE COL_TYPE,(SELECT COMMENTS FROM ALL_COL_COMMENTS CM WHERE CM.TABLE_NAME = C.TABLE_NAME AND CM.OWNER = C.OWNER AND CM.COLUMN_NAME = C.COLUMN_NAME AND ROWNUM =1) COL_COMMENT
FROM
ALL_TAB_COLUMNS C
WHERE
C.TABLE_NAME ='tableName'AND C.OWNER ='userName'
--COL_NAME字段名,COL_TYPE字段类型,COL_COMMENT字段含义;--tableName表名,userName用户模式名;SELECT
COLS.NAME COL_NAME,
COLS.TYPE COL_TYPE,
COLS.RESVD5 COL_COMMENT
FROM
SYSDBA.SYSTABLES T
INNERJOIN
SYSDBA.SYSCOLUMNS COLS
ON
COLS.ID=T.ID
INNERJOIN
SYSDBA.SYSSCHEMAS SCH
ON
SCH.SCHID=T.SCHID
WHERE
T.NAME='tableName'AND SCH.NAME ='userName'
4.达梦7数据库
--COL_NAME字段名,COL_TYPE字段类型,COL_COMMENT字段含义,COL_LENGTH字段长度;--tableName表名,userName用户模式名;SELECT
COLS.NAME COL_NAME ,
COLS.TYPE$ COL_TYPE ,
CC.COMMENT$ COL_COMMENT,
COLS.LENGTH$ COL_LENGTH
FROM
SYSOBJECTS T
INNERJOIN SYSCOLUMNS COLS
ON
COLS.ID=T.ID
LEFTJOIN SYSCOLUMNCOMMENTS CC
ON
CC.TVNAME =T.NAME
AND COLS.NAME =CC.COLNAME
AND CC.SCHNAME='userName'LEFTJOIN SYSTABLECOMMENTS TC
ON
TC.TVNAME =T.NAME
AND TC.TABLE_TYPE='TABLE'AND TC.SCHNAME ='userName'WHERE
T.NAME ='tableName'AND T.SCHID=(SELECT ID FROM SYSOBJECTS WHERETYPE$='SCH'AND NAME='userName')