D
D
Dmitry2020-11-24 19:22:03
MySQL
Dmitry, 2020-11-24 19:22:03

Combining multiple requests into one, an error in one request interrupts others. How to let all requests work?

INSERT INTO `idAll`(`id`) VALUES ("awiSmp0XmYE"); // Вызывает ошибку так как значение дублируется в базе.
INSERT INTO `idAll`(`id`) VALUES ("WWWWW"); // Будет не выполнена, так как запрос выше вызвал ошибку

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2020-11-24
@inilim

There is INSERT IGNORE (so-so solution, because it will ignore all errors).
There is an INSERT ... ON DUPLICATE KEY UPDATE that can be adapted .
If queries are made through the mysql client, there is a -f switch .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question