DELIMITER $$
DROP PROCEDURE IF EXISTS
`enterpriseaccessv2`.`prc_citysummary`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE
`prc_citysummary`(in cityname varchar (200),in username varchar(200),in
city_code varchar(200),
out c_onnet varchar(1000),
out c_section varchar(1000),
out c_rings varchar(1000),
)
BEGIN
SET
@section = '';
SET
@Ring = '';
SELECT count(*) into c_onnet FROM ovlcustomerinformation WHERE CityCode = city_code and customer_type
= 'onnet';
SET @s= CONCAT('select count(section_name)
INTO @section from ',city_code,'_sectiondetails');
PREPARE stmt FROM @s;
EXECUTE stmt;
SET @s1 = CONCAT('select
count(distinct BOP_RingName) INTO @Ring
from ',city_code,'_ringdetails');
PREPARE stmt FROM @s1;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET
c_section = @section;
SET
c_rings = @Ring;
END$$
DELIMITER ;
Call Procedure
call prc_citysummary('Bhopal','sunil','G004',@c_onnet,@c_section,@c_rings)
select @c_onnet,@c_section,@c_rings
Call Procedure
call prc_citysummary('Bhopal','sunil','G004',@c_onnet,@c_section,@c_rings)
select @c_onnet,@c_section,@c_rings