17 lines
407 B
MySQL
17 lines
407 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_kill`(vSelf INT)
|
||
|
BEGIN
|
||
|
/**
|
||
|
* Elimina una coleccion y coloca sus tickets en OK
|
||
|
*/
|
||
|
INSERT INTO ticketTracking(stateFk, ticketFk)
|
||
|
SELECT s.id, ticketFk
|
||
|
FROM vn.ticketCollection tc
|
||
|
JOIN vn.state s ON s.code = 'OK'
|
||
|
WHERE tc.collectionFk = vSelf;
|
||
|
|
||
|
DELETE FROM vn.collection
|
||
|
WHERE id = vSelf;
|
||
|
END$$
|
||
|
DELIMITER ;
|