2019-05-31 11:28:28 +00:00
|
|
|
DROP procedure IF EXISTS `vn`.`zoneNest`;
|
2019-06-04 19:05:43 +00:00
|
|
|
|
|
|
|
DELIMITER $$
|
|
|
|
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`zoneNest`()
|
|
|
|
BEGIN
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGeo;
|
|
|
|
CREATE TEMPORARY TABLE tmp.zoneGeo
|
|
|
|
(id INT AUTO_INCREMENT PRIMARY KEY)
|
|
|
|
ENGINE = MEMORY
|
|
|
|
SELECT * FROM vn.zoneGeo;
|
|
|
|
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.country;
|
|
|
|
CREATE TEMPORARY TABLE tmp.country
|
|
|
|
SELECT id FROM country
|
|
|
|
WHERE country IN('España exento');
|
|
|
|
|
|
|
|
CALL vn.zoneNestCountry();
|
|
|
|
CALL vn.zoneNestProvince();
|
|
|
|
CALL vn.zoneNestTown();
|
|
|
|
CALL vn.zoneNestPostcode();
|
|
|
|
CALL vn.nestTree('tmp', 'zoneGeo', 'vn', 'zoneGeo');
|
|
|
|
|
|
|
|
DROP TEMPORARY TABLE
|
|
|
|
tmp.zoneGeo,
|
|
|
|
tmp.country;
|
|
|
|
END$$
|
|
|
|
|
|
|
|
DELIMITER ;
|