Hi All
I have requirement to get maximum column data length for existing record set.
As a example I got below record set and need to get maximum length of each column
data length*
Basically this is because to align the data by padding when writing to the text file. So if I get the max data length in the column, could replace value 15 (i.e. %-15s)
ResultSet rs = st.executeQuery(SQuery);
while (rs.next()) {
String col1 = rs.getString(output1);
String col2 = rs.getString(output2);
String col3 = rs.getString(output3);
data.add(col1.format("%-15s", col1) + "\t" + col2.format("%-15s", col2) + "\t\t" + col3);
}
Or if any alternative.......
cheers