日期:2014-05-20 浏览次数:20672 次
BI_ALARM_RULE 更换给自己的表名java获取oracle数据库表注释
SELECT b.column_name column_name --字段名
,b.data_type data_type --字段类型
,b.data_length --字段长度
,a.comments comments --字段注释
FROM user_col_comments a
,all_tab_columns b
WHERE a.table_name = b.table_name and
a.table_name = 'BI_ALARM_RULE';
String commentSql = " show full fields from " + tableName;
Map<String,String> comment= new HashMap<String,String>();
try{
pstmt2 = conn.prepareStatement(commentSql);
rs2=pstmt2.executeQuery();
while(rs2.next()){
String comm = rs2.getString("Comment");
if(null != comm && !comm.equals("")){
comment.put(rs2.getString("Field"), comm);
}else{
comment.put(rs2.getString("Field"), rs2.getString("Field"));
}
}