SQL ERROR 1442. What can it be?

Asked

Viewed 52 times

0

The error appears when I try to insert something in bank 3, because Trigger will be activated and will insert in bank2, but I am not performing 2 shares in the same table as the error tells...

INSERT INTO banco3.Clientes VALUES (6,'RoseMel', '1998-05-08', '48381856' '4539-6', 'ananana', 'oqe?', '162', 'sasnaush', 'qsjqijqiwj',
                                    'SP', '13720000');
DELIMITER $$

CREATE TRIGGER insereBanco3 AFTER INSERT
ON banco3.clientes FOR EACH ROW

BEGIN
        INSERT INTO banco2.cli(id, nome, dat_nascimento, cpf, rg, endereco, numero, bairro, cidade, estado, cep)
        VALUES(NEW.id, NEW.nome, NEW.dat_nascimento, NEW.cpf, NEW.rg, NEW.endereco, NEW.numero, NEW.bairro, NEW.cidade, NEW.estado, NEW.cep); 
END;

$$
  • Make sure you don’t have one trigger in banco2.cli. I did a very simple test using your code and did not show any https://www.db-fiddle.com/f/gDkRvHph7afaNouggBeRDE/0error

  • I integrate 3 banks in reality (bank 2 serves as intermediary for bank 1 not access bank 3 and vice versa). The problem happens when I start using the third bank. When I use only 2, everything is fine. I read the mysql documentation and apparently it doesn’t allow for two actions in the same table (since both bank 1 and bank 3 insert in the same table as bank 2). I need to confirm to know if I try to fix this fault or if I change sql server. I am too inexperienced to make this decision haha

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.