begin declare i int default 0; while i < 40 do insert into users(userID,userName,password) values(i,concat('username',i),concat('password',i)); set i = i + 1; end while; end
12.8.6.7. WHILE Statement [begin_label:] WHILE search_condition DO statement_list END WHILE [end_label] The statement list within a WHILE statement is repeated as long as the search_condition is true. statement_list consists of one or more statements. A WHILE statement can be labeled. end_label cannot be given unless begin_label also is present. If both are present, they must be the same. Example: CREATE PROCEDURE dowhile() BEGIN DECLARE v1 INT DEFAULT 5; WHILE v1 > 0 DO ... SET v1 = v1 - 1; END WHILE; END
56,687
社区成员
56,710
社区内容
加载中
试试用AI创作助手写篇文章吧