Esteban Dicent Esteban Dicent -4 years ago 390
MySQL Question

mysql missing semicolon Why?

missing semicolon

delimiter $$
create procedure SP_ADD_USER( IN nom varchar(45), IN turn varchar(45), IN age int(11), in price int(11), in dates varchar(45))
begin insert into datos
(nombre, turno, edad, precio, fecha)
values
(nom ,turn, age, price, dates) missing semicolon in this ``

end $$
delimiter;

Answer Source

You're missing a semicolon because you're expected to delimit each statement with a semicolon. From MySQL documentation:

A query normally consists of an SQL statement followed by a semicolon. [...]

The new delimiter you define in the first row is applied to the "outer" statement, that is the procedure creation; this way the interpreter knows where a piece of the procedure ends and where the whole procedure ends.

delimiter $$
create procedure SP_ADD_USER (
    IN nom varchar(45),
    IN turn varchar(45),
    IN age int(11),
    IN price int(11), 
    IN dates varchar(45))
begin
    insert into datos (nombre, turno, edad, precio, fecha) 
    values (nom ,turn, age, price, dates);
end $$
delimiter;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download