Double INSERT no stored

Asked

Viewed 108 times

0

Currently what I have is basically 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 nay has connection with each other.

  • I didn’t understand your doubt, I could explain it better?

  • I want to know how to make two Insert’s in one Procedure in two different tables at the same time

1 answer

1


Makes no sense 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 ;

Browser other questions tagged

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