I am trying to check in the database that if the record exists then don't insert. The following code is working well but I want to print that what records not inserted.
Thanks & best regards
if(category.equals("1")){ String query="select aa from aa where aa=?"; String query1="insert into aa(aa) values(?)";
for(i=0;i<listVal.length;i++){ ps.setString(1, listVal[i]); rs=ps.executeQuery(); if(rs.next()){ String exists=rs.getString(1); if(listVal[i].equals(exists)){ //ExiststedRecords=???Her I want to print that these records exists
} }else{ update out.println("("+count+") Record Inserted Successfull<br>"+ "The following Records already exists in database<br>"+ExistedRecords); }