I already have a table employee with columns name(String),id(int),age(int). I can't figure out where the syntax is wrong?
我已经有一个包含列名(String),id(int),age(int)的表employee。我无法弄清楚语法错在哪里?
CREATE PROCEDURE recins (
name1 IN employee.name%type ,
id1 IN employee.id%type ,
age1 IN employee.age%type
) AS
BEGIN
INSERT INTO employee VALUES(name1,id1,age1);
END;
1 个解决方案
#1
1
create table employee2
(
name varchar(100) not null,
id int not null,
age int not null
);
DELIMITER $$
CREATE PROCEDURE recins (
IN name1 varchar(100),
IN id1 int,
IN age1 int
)
BEGIN
INSERT INTO employee2 (name,id,age) VALUES(name1,id1,age1);
END $$
DELIMITER ;
-- test:
call recins('a',1,2);
delimiter is a special wrapper for stored procs, events, functions. Delimiter ;
at the end of the stored proc sets it back to the normal/default delimiter of a semi-colon.
delimiter是存储过程,事件和函数的特殊包装器。分隔符;在存储过程结束时将其设置回分号的正常/默认分隔符。
The above was tested.
以上测试。
#1
1
create table employee2
(
name varchar(100) not null,
id int not null,
age int not null
);
DELIMITER $$
CREATE PROCEDURE recins (
IN name1 varchar(100),
IN id1 int,
IN age1 int
)
BEGIN
INSERT INTO employee2 (name,id,age) VALUES(name1,id1,age1);
END $$
DELIMITER ;
-- test:
call recins('a',1,2);
delimiter is a special wrapper for stored procs, events, functions. Delimiter ;
at the end of the stored proc sets it back to the normal/default delimiter of a semi-colon.
delimiter是存储过程,事件和函数的特殊包装器。分隔符;在存储过程结束时将其设置回分号的正常/默认分隔符。
The above was tested.
以上测试。