DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_clone`(vEntryFk INT) BEGIN /** * Clone buys to an entry * * @param vEntryFk The entry id * @table tmp.buy(id) */ INSERT INTO buy( entryFk, itemFk, quantity, buyingValue, freightValue, isIgnored, stickers, packagingFk, packing, `grouping`, groupingMode, comissionValue, packageValue, price1, price2, price3, minPrice, isChecked, location, weight, itemOriginalFk) SELECT vEntryFk, b.itemFk, b.quantity, b.buyingValue, b.freightValue, b.isIgnored, b.stickers, b.packagingFk, b.packing, b.`grouping`, b.groupingMode, b.comissionValue, b.packageValue, b.price1, b.price2, b.price3, b.minPrice, b.isChecked, b.location, b.weight, b.itemOriginalFk FROM tmp.buy tb JOIN vn.buy b ON b.id = tb.id; END$$ DELIMITER ;