Numbers count in mysql,Mysql Increment Numbers

Increment Numbers In Mysql.

Example Procedure.
DROP PROCEDURE NumbersCountTable;
CREATE PROCEDURE NumbersCountTable($StartNo Int,$EndNo Int)
BEGIN
  
  DROP TABLE IF EXISTS NumbersCountTable;
  CREATE TABLE NumbersCountTable (
    `Number` int
  );
    WHILE $StartNo <= $EndNo DO
        INSERT INTO NumbersCountTable (`Number`) VALUES ($StartNo);
        SET $StartNo = $StartNo + 1;
    END WHILE;
   SELECT * FROM NumbersCountTable;
END


CALL NumbersCountTable(@$StartNo:=0,@$EndNo:=30);
 
SELECT * FROM NumbersCountTable

Result:

Post a Comment

0 Comments