Dit is iets dat doorgaans beter kan in iets anders dan SQL, zoals java.
Pseudo-code kan zijn:
List<String> names = jdbcTemplate.query("select A from your_table", new RowMapper() {
public Object mapRow(ResultSet resultSet, int i) throws SQLException {
return resultSet.getString(1);
}
});
for (String name : names) {
String[] strings = name.split("[\\w,]");
for (int i = 0; i < strings.length; i++) {
String string = strings[i];
jdbcTemplate.update("insert ignore into new_table (B) values (?)", string);
}
}