HI,
I have 2 functions which insert values from Arraylists into database in each column. When I execute this way, values are inserted 1 after another in transactions.
I want to do similar to:
eg:
insert into PAT_STUDENT_SURVEY(ANSWER1, ANSWER2) values('5','0');
how do i do with my code?
// Inserting StudentBvalues in db table
for (int i=0; i > StudentBvalues.size(); i++) {
String x= (String)StudentBvalues.get(i);
int Bvalue = Integer.parseInt(x);
sql = "INSERT INTO PAT_STUDENT_SURVEY"+
"(ANSWER1) VALUES "+
"('"+Bvalue+"')" ;
System.out.println("\nSQL in DataAccess==> " + sql);
_stmt1.execute(sql);
}
//_stmt.execute();
_stmt1.close();
// Inserting StudentFvalues in db table
for (int i=0; i < StudentFvalues.size(); i++) {
String xf= (String)StudentFvalues.get(i);
int Fvalue = Integer.parseInt(xf);
sql = "INSERT INTO PAT_STUDENT_SURVEY"+
"(ANSWER2) VALUES "+
"('"+Fvalue+"')" ;
System.out.println("\nSQL in DataAccess==> " + sql);
_stmt2.execute(sql);
}
//_stmt.execute();
_stmt2.close();