Home  >  Article  >  Backend Development  >  生成大量随机数 存入数据库,该如何处理

生成大量随机数 存入数据库,该如何处理

WBOY
WBOYOriginal
2016-06-13 10:11:57917browse

生成大量随机数 存入数据库
比如我想1000个10位随机数 然后插入数据库 有没有什么比较高效的方法呢?

------解决方案--------------------
来个PROCEDURE

SQL code
DROP PROCEDURE IF EXISTS `insert`;CREATE PROCEDURE `insert`(num int)BEGINDECLARE i INT;DECLARE var INT;SET i=1;WHILE i<num do set var="FLOOR(RAND()*10000000000);" insert into table values i="i+1;END" while class="clear">
                 
              
              
        
            </num>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn