22 lines
667 B
SQL
22 lines
667 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`msg`(IN memTXT VARCHAR(255), IN idREM INTEGER, idDES INTEGER)
|
|
BEGIN
|
|
DECLARE last_ID INTEGER;
|
|
DECLARE codDES CHAR(3);
|
|
|
|
SELECT CodigoTrabajador INTO codDES FROM Trabajadores WHERE Id_Trabajador = idDES;
|
|
|
|
INSERT INTO Mensajes(Mensaje,Fecha,Remitente,Destinatario)
|
|
VALUES(memTXT, util.VN_NOW(),idREM, idDES);
|
|
|
|
SELECT LAST_INSERT_ID() INTO last_ID;
|
|
|
|
|
|
INSERT INTO Incidencias(Incidencia,Id_Trabajador,Destino,Fecha,Fecha_Mod)
|
|
VALUES (CONCAT('@@ ',last_ID),idREM,codDES,util.VN_NOW(),util.VN_NOW());
|
|
|
|
|
|
|
|
END$$
|
|
DELIMITER ;
|