I have table employee
I retrieve the columns as select emp_name,emp_add from employee
while(iResultSet1.next())
{
List expRptColWise = new ArrayList();
for(Integer i=1;i<=iResultSet1.getMetaData().getColumnCount();i++){
expRptColWise.add(iResultSet1.getString(i));
}
expRptRowWise.add(expRptColWise);
With the above snippet ,I get
emp_name | emp_add |
A | add1 |
B | add2 |
I want to add Serial No. coloumn in resultset so that I get result as
emp_name | emp_add |Sr_No|
A | add1 |1 |
B | add2 |2 |
Please guide me how to add column dynamically in resultset or collection object ,Here I have used ArrayList.
use the following query
select emp_name,emp_add, (ROW_NUMBER() OVER ( ORDER BY emp_name)) AS sr_no from employee
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With