Code example for ResultSet

Methods: firstgetLong

0
			String selectQuery = String.format("SELECT id FROM %s",
					sequence_table);
			ResultSet resultSet = statement.executeQuery(selectQuery);
 
			long lastID;
			if (resultSet.first()) {
 
				lastID = resultSet.getLong("id");
				lastID++;
 
				statement.executeUpdate(String.format("UPDATE %s SET id=%d",
						sequence_table, lastID));
 
			} else { 
				throw new SQLException(sequence_table
						+ " didn't return a new id"); 
			} 
 
			connection.commit();
 
Experience pair programming with AI  Get Codota for Java