DELIMITER $$
DROP PROCEDURE IF EXISTS `world`.`UNBOUND_DEMO` $$
CREATE DEFINER=`tusa`@`%` PROCEDURE `UNBOUND_DEMO`(districtName VARCHAR(35))
BEGIN
    SELECT  ID, Name, CountryCode,District,Population FROM City where  District=districtName  order by Name;
    Select  ID, Name, CountryCode,District,Population FROM City
      WHERE District=districtName AND Population = (Select MAX(Population) from city where  District=districtName );
END $$
DELIMITER ;
tusa@localhost:3306 [world]> CALL UNBOUND_DEMO('Lombardia');
+------+---------+-------------+-----------+------------+
| ID   | Name    | CountryCode | District  | Population |
+------+---------+-------------+-----------+------------+
| 1497 | Bergamo | ITA         | Lombardia |     117837 |
| 1480 | Brescia | ITA         | Lombardia |     191317 |
| 1465 | Milano  | ITA         | Lombardia |    1300977 |
| 1496 | Monza   | ITA         | Lombardia |     119516 |
+------+---------+-------------+-----------+------------+
4 rows in set (0.00 sec)
+------+--------+-------------+-----------+------------+
| ID   | Name   | CountryCode | District  | Population |
+------+--------+-------------+-----------+------------+
| 1465 | Milano | ITA         | Lombardia |    1300977 |
+------+--------+-------------+-----------+------------+

Latest conferences

We have 62 guests and no members online

oracle_ace