27 lines
465 B
SQL
27 lines
465 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_clone`(IN vSelf INT, OUT newEntryFk INT)
|
|
BEGIN
|
|
/**
|
|
* clones an entry.
|
|
*
|
|
* @param vSelf The entry id
|
|
*/
|
|
DECLARE vNewEntryFk INT;
|
|
|
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
BEGIN
|
|
ROLLBACK;
|
|
RESIGNAL;
|
|
END;
|
|
|
|
START TRANSACTION;
|
|
|
|
CALL entry_cloneHeader(vSelf, vNewEntryFk, NULL);
|
|
CALL entry_copyBuys(vSelf, vNewEntryFk);
|
|
|
|
COMMIT;
|
|
SET newEntryFk = vNewEntryFk;
|
|
|
|
END$$
|
|
DELIMITER ;
|