memphisTNdev22
Programmer
I am tring to execute the following query in a JSP and a I am getting a java.sql.SQLException: invalid column index
what am I doing wrong.....
String sqva = "Select atc.mobn, atc.accn, atc.acct_name, atc.act_date, rtrim(atc.svc_name), atc.comamt from atlcomm atc where atc.acin in ('PA','RA','FA') and rtrim(atc.svc_name) in (select c.svc_name from comm_bonus_rqrmnt_services c where c.ct_acts = 'Y' and c.req_type = 4 and '"+currDate+"' between c.act_month and NVL(c.end_month,to_char(sysdate,'yyyymm'))) and atc.sman in '"+pinCode+"' and atc.comm_date = '"+currDate+"' order by atc.mobn";
System.out.println("query is" + sqva);
LinkedList qryVa = new LinkedList();
ResultSet rsva = DbDisplay.executeQuery(sqva);
while (rsva.next()) {
List rows = new ArrayList();
for (int i=1; i < 7; i++) {
System.out.println("Sting is" + rsva.getString(i));
System.out.println("Sting is" + (i));
rows.add(rsva.getString(i));
if (i == 6) {
if (rsva.getString(i) != null) {
double comAmt = rsva .getDouble(i);
vactTotal = vactTotal + comAmt;
}
}
}
qryVa.add(rows);
}
rsva.close();
what am I doing wrong.....
String sqva = "Select atc.mobn, atc.accn, atc.acct_name, atc.act_date, rtrim(atc.svc_name), atc.comamt from atlcomm atc where atc.acin in ('PA','RA','FA') and rtrim(atc.svc_name) in (select c.svc_name from comm_bonus_rqrmnt_services c where c.ct_acts = 'Y' and c.req_type = 4 and '"+currDate+"' between c.act_month and NVL(c.end_month,to_char(sysdate,'yyyymm'))) and atc.sman in '"+pinCode+"' and atc.comm_date = '"+currDate+"' order by atc.mobn";
System.out.println("query is" + sqva);
LinkedList qryVa = new LinkedList();
ResultSet rsva = DbDisplay.executeQuery(sqva);
while (rsva.next()) {
List rows = new ArrayList();
for (int i=1; i < 7; i++) {
System.out.println("Sting is" + rsva.getString(i));
System.out.println("Sting is" + (i));
rows.add(rsva.getString(i));
if (i == 6) {
if (rsva.getString(i) != null) {
double comAmt = rsva .getDouble(i);
vactTotal = vactTotal + comAmt;
}
}
}
qryVa.add(rows);
}
rsva.close();