create or replace procedure allocate(IN N int) declare
bal int;
num int default 0;
lo int;
mlo int;
con int default 100000;
ano int default 10000; begin
while num<=N loop
set num=num+1;
set ano=ano+num;
set mlo=floor(rand()*con) as int;
set lo=floor(rand()*mlo) as int;
set bal=floor(rand()*con) as int;
insert into Account
values(ano,bal,lo,mlo);
commit;
end loop;
end;在kingbase数据库中可以正确执行,在MySQL中则报错:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'procedure allocate(IN N int)
begin
declare
bal int;
num int defau' at line 1
bal int;
num int default 0;
lo int;
mlo int;
con int default 100000;
ano int default 10000; begin
while num<=N loop
set num=num+1;
set ano=ano+num;
set mlo=floor(rand()*con) as int;
set lo=floor(rand()*mlo) as int;
set bal=floor(rand()*con) as int;
insert into Account
values(ano,bal,lo,mlo);
commit;
end loop;
end;在kingbase数据库中可以正确执行,在MySQL中则报错:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'procedure allocate(IN N int)
begin
declare
bal int;
num int defau' at line 1
解决方案 »
- #1690 - BIGINT UNSIGNED value is out of range in .... INT(11) UNSIGNED
- 大家好,我想问一个关于游标遍历插入新表出现主键重复的问题
- MySql表类型InnoDB和MyISAM在进行limit查询时遇到的问题
- 新年快乐,暨你在什么情况会选择MYSQL做为数据库?
- Linux下mysqldump备份数据库出错
- mysql5.0中如何运行sql脚本?
- 求救!!关于mysql c api 的问题
- 关于多表删除的问题
- 怎样排除相同的项
- 停车场停车时长统计+++++++++++++
- MySql经常无故自动停止服务,求帮助
- MySQL安装时报错2013
这个之后BEGIN哪去了?
而且需要每一行一个declare