0

I would like to do an loop with cursor which will take number of registration in each table. And after display "name : result".

I have this structur :

DELIMITER  $$
DROP PROCEDURE IF EXISTS  num_reg  $$
CREATE PROCEDURE  num_reg ()
BEGIN
   DECLARE cur1 CURSOR FOR SELECT count (*) FROM database;
   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1;
    OPEN cur1;
    first_loop: LOOP
    
    -- here I save result of cursor in variable and I display it.

    END LOOP first_loop;
    CLOSE cur1;


END $$

I don't know how I can take informations. And I don't know name of table in advance.

Exemple: If I have my database shop with 2 tables buyer and seller in each table I have 2 rows When I execute Procedure output is : buyer : 2 seller : 2

Milirium
  • 31
  • 1
  • 4

0 Answers0