-- copia a linha do produto original para criar a sample
CREATE TEMPORARY TABLE tmptable_1 SELECT * FROM product WHERE idproduct = p_idproduct;
UPDATE tmptable_1 SET idproduct = NULL, url = NULL;
INSERT INTO product SELECT * FROM tmptable_1 LIMIT 1;
DROP TEMPORARY TABLE IF EXISTS tmptable_1;
SELECT LAST_INSERT_ID() into @idproduct;
-- copia os shipments do produto original para criar a sample
CREATE TEMPORARY TABLE tmptable_1 SELECT * FROM product_shipping WHERE idproduct = p_idproduct;
UPDATE tmptable_1 SET idshipping = NULL, idproduct = @idproduct, ativo = 1;
INSERT INTO product_shipping SELECT * FROM tmptable_1;
DROP TEMPORARY TABLE IF EXISTS tmptable_1;