mysql create procedure with in parameters ,call procedure

复制代码
//create procedure statement
delimiter $$
use db $$ drop procedure if exists insertIntoT1Table; create procedure insertIntoT1Table(in num int) begin declare i int default 1; while(i<num) do insert into t1(name,abstract,author,content,summary) values(uuid(),uuid(),uuid(),uuid(),uuid()); set i=i+1; end while; end $$
复制代码

call procedure

call insertIntoT1Table(100);

 

复制代码
 show create procedure insertIntoT1Table \G;
*************************** 1. row ***************************
           Procedure: insertIntoT1Table
            sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
    Create Procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `insertIntoT1Table`(in num int)
begin
declare i int default 1;
while(i<num) do
insert into t1(name,abstract,author,content,summary) values(uuid(),uuid(),uuid(),uuid(),uuid());
set i=i+1;
end while;
end
character_set_client: utf8mb4
collation_connection: utf8mb4_0900_ai_ci
  Database Collation: utf8mb4_0900_ai_ci
1 row in set (0.00 sec)

ERROR: 
No query specified
复制代码

 

posted @   FredGrit  阅读(8)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
历史上的今天:
2022-09-08 decltype delay type
2020-09-08 C# dynamic class inherit from dynamicobject
2019-09-08 dictionary vs Hashtables
2019-09-08 sql
2019-09-08 sql server pivot
2019-09-08 C# regular expression to validate email
点击右上角即可分享
微信分享提示