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

19 lines
454 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`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 ;