DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_del`(vSaleFk INT, vState VARCHAR(50))
BEGIN

	DELETE FROM itemShelvingSale
		WHERE saleFk = vSaleFk;

	DELETE st.*
		FROM vn.saleTracking st
			JOIN vn.state s ON s.id = st.stateFk
		WHERE st.saleFk = vSaleFk 
			AND s.code = vState COLLATE utf8_unicode_ci;
	
END$$
DELIMITER ;
