The insert statement is working fine for one table but when I try to insert into two it gives an error. Could you see the code below and give me any feedback?
public void insertContact() throws SQLException {
System.out.println("Please enter your ID");
String id = input.next();
System.out.println("Please enter your phone number");
String number = input.next();
try (Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)) {
ResultSet rs = stmt.executeQuery("SELECT * FROM Contact "
+ "LEFT OUTER JOIN ContactTelNo "
+ "ON Contact.ContactId = ContactTelNo.ContactId");
rs.moveToInsertRow();
rs.updateString(idTable, id);
rs.updateString(numberTable, number);
rs.insertRow();
}
}