mysql> create table t_1(
-> id varchar(10) not null primary key,
-> name varchar(10),
-> score varchar(10)
-> );
Query OK, 0 rows affected
我现在想把t_1中插入一万条数据,应该怎么使用存储过程?本人菜鸟,急求指教,谢谢!!!!
可以的,出错是因为权限问题,不好意思,谢谢了。
Error Code : 1064
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 'PROCDURE proc_Insert
@count INT
AS
declare @i int=0
declare @j int=0
select @i =' at line 1
执行后报这样的错,找了很久也不知道是什么原因
这个是mysql的写法吗?为什么我执行后有很多错
追答这个是PL/SQL语句,用在ORACLE上的。MYSQL没用过,应该要用脚本导入。
追问哦,FOR R IN 1..10000 LOOP,R不需要定义吗?
追答这个是PL/SQL语句,用在ORACLE上的。MYSQL没用过,应该要用脚本导入。
你试试下面这段代码,写个存储过程,然后调用。
DELIMITER $$
DROP ROCEDUREIFEXISTS `dsdvrdbm`.`test` $$
CREATE PROCEDURE `test`()
BEGIN
set @v_n=1;
while@v_n<1000 do
insertinto t_1(id,name,score) values (@v_n,'MM','f');
set @v_n=@v_n+1;
ENDwhile ;
END $$
DELIMITER ;
--以上是写存储过程。
call test();--这个是调用
PL/SQL中,那个R不需要定义。
(0 row(s) affected, 1 warning(s))
Execution Time : 00:00:00:000
Transfer Time : 00:00:01:014
Total Time : 00:00:01:014
Error Code : 1304
PROCEDURE test already exists
为什么会程序测试已经存在?