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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:45:10
Original
776 people have browsed it

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

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

SQL code
DROP PROCEDURE IF EXISTS `insert`;

CREATE PROCEDURE `insert`(num int)
BEGIN
DECLARE 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 call class="clear">
                 
              
              
        
            </num>
Copy after login
Related labels:
Statement of this Website
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
Latest Issues
php - pdo fails to insert data into database?
From 1970-01-01 08:00:00
0
0
0
Pass array to SQL insert query using PHP
From 1970-01-01 08:00:00
0
0
0
mongodb - How to batch insert data in mongoose?
From 1970-01-01 08:00:00
0
0
0
python - mysql insert error in multithreading
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template