Double INSERT in stored procedure

0

Currently what I basically have is this:

CREATE PROCEDURE 'Teste'(
    IN '@valorX' INT, 
    IN '@valorY' INT
)
NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER 
INSERT INTO tabelaX(colunaX) VALUES (@valorX)
INSERT INTO tabelaY(colunaY) VALUES (@valorY)

Note: The two tables do not have links to each other.

    
asked by anonymous 24.10.2018 / 15:14

1 answer

1

It does not make sense for two inserts at the same time, since this command is directed to a table; but you can have two in the same proc :

DELIMITER //

CREATE PROCEDURE proccomdoisinserts(IN valorX INT, IN valorY INT)
   BEGIN
     INSRT INTO tabelaX(colunaX) VALUES (valorX);
     INSRT INTO tabelaX(colunaX) VALUES (valorY);
   END;
//

DELIMITER ;
    
26.10.2018 / 12:53