在获取具有诸如类型object之类的列的表的元数据时。 调用DatabaseMetaData.getColumns并使用next方法遍历结果集时出现异常
ORA-01427:单行子查询返回多个行
private void searchForColumnNameInTables(DatabaseMetaData dmd) throws SQLException {
Iterator iter = listOfTables.iterator();
while (iter.hasNext()) {
String tableName = (String) iter.next();
java.sql.ResultSet rs1 = dmd.getColumns(catalog, schema, tableName, "%"); //
//java.sql.ResultSet rs1 = dmd.getUDTs(tableName, schema, "%", null);
while (rs1.next()) {
String colName = rs1.getString(4);
String colType = rs1.getString(5);
System.out.println("Table " + tableName + " ColumnName" + colName + " ColumnType" + colType);
if (colName.trim().toLowerCase().equals(colNameToSearchFor)) { //
System.out.println("found '" + colNameToSearchFor + "' in " + tableName);
}
}
}
}