DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleTracking_add`(vSaleGroupFk INT) BEGIN /** Inserta en vn.saleTracking las lineas de una previa * * @param vSaleGroupFk Identificador de vn.saleGroup */ REPLACE vn.saleTracking( saleFk, isChecked, workerFk, stateFk ) SELECT sgd.saleFk , TRUE, account.myUser_getId(), s.id FROM vn.saleGroupDetail sgd JOIN vn.state s ON s.code = 'ON_PREPARATION' WHERE sgd.saleGroupFk = vSaleGroupFk; END$$ DELIMITER ;