获得orale数据库表的主键列名称。
/**
* 获得表的主键
* @param tableName表名
* @return
*/
static public String getPrimaryKey(String tableName){
DBTool db = new DBTool();
Record records[] = db.executeQuery("select column_name from user_cons_columns " +
"where constraint_name = (select constraint_name from " +
"user_constraints where table_name = '"+tableName+"' and " +
"constraint_type = 'P')", null);
if(0<records.length){
return records[0].getString("COLUMN_NAME");
}else{
return null;
}
}