salix/db/routines/vn/procedures/entry_copyBuys.sql

19 lines
452 B
MySQL
Raw Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_copyBuys`(vSelf INT, vDestinationEntryFk INT)
BEGIN
/**
* Copies all buys from an entry to an entry.
*
* @param vSelf The entry id
* @param vDestinationEntryFk The destination entry id
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.buy
SELECT id
FROM buy
WHERE entryFk = vSelf;
CALL buy_clone(vDestinationEntryFk);
DROP TEMPORARY TABLE tmp.buy;
END$$
DELIMITER ;