
package processing;
import java.io.; import java.math.BigDecimal; import java.sql.; import java.util.*;
public class Processing {
public static void main(String[] args) {
String str = "9035";
try {
Connection con = null;
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/asteriskcdrdb", "root", "techsoft");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("Select * from asteriskcdrdb.sp1 where areacode like '" + str + "'");
while (rs.next()) {
String AreaCode = rs.getString("AreaCode");
// System.out.println(AreaCode);
String Pulse = rs.getString("Pulse");
int Rate = rs.getInt("Rate/pulse");
//System.out.println(Rate);
String Location = rs.getString("Location");
if (AreaCode.equals(str)) {
//System.out.println("Hii");
rs = st.executeQuery("Select * from cdr");
while (rs.next()) {
String calldate = rs.getString("calldate");
//System.out.println(calldate);
String clid = rs.getString("clid");
String src = rs.getString("src");
String dst = rs.getString("dst");
String dcontext = rs.getString("dcontext");
String channel = rs.getString("channel");
String dstchannel = rs.getString("dstchannel");
String lastapp = rs.getString("lastapp");
String lastdata = rs.getString("lastdata");
String duration = rs.getString("duration");
// System.out.println(duration);
int dur = Integer.parseInt(duration);
String billsec = rs.getString("billsec");
String disposition = rs.getString("disposition");
String amaflags = rs.getString("amaflags");
String accountcode = rs.getString("accountcode");
String uniqueid = rs.getString("uniqueid");
String userfield = rs.getString("userfield");
int min = 60;
int quotient = dur / min;
//System.out.println(quotient);
int reminder = dur % min;
// System.out.println(reminder);
int cost = 0;
if (reminder > 0) {
quotient = quotient + 1;
//System.out.println(quotient);
cost = quotient * Rate;
System.out.println(cost);
}
*
}
}
}
rs.close();
st.close();
} catch (Exception e) {
System.out.println(e);
}
}
}

You need to use another object of ResultSet. You are using same object with different queries, therefore exception occurs.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.