1

I am trying to create a stored procedure and i am getting an error code.

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 '' at line 12

I'm not the greatest with MYSQL and I'm unsure where to even look to figure the problem out.

Create Procedure Sp_insertCustomer(
    IN Customer_id VARCHAR(20) ,
    IN UserName VARCHAR(20), 
    IN Fname VARCHAR(20), 
    IN Lname VARCHAR(20), 
    IN Dob Date, 
    IN Address VARCHAR(250),
    IN Phone INT,
    IN Email VARCHAR(250), 
    IN Ss VARCHAR(9) )
BEGIN
INSERT INTO Customer (Cusomter_id,UserName,Fname,Lname,Dob,Address,Phone,Email,Ss)       
VALUES (in_Customer_id ,in_UserName , in_Fname , in_Lname , in_Dob , in_Address , in_Phone , in_Email , in_Ss);
END
1
  • 1
    The variables inside the INSERT VALUES section do not match your in Parameters. Commented Apr 21, 2016 at 14:47

2 Answers 2

1

1) Your parameters and values in insert statement are different: Customer_id is parameter and in_Customer_id in insert statement

2) add delimeters

DELIMITER $$

< your procedure >

END$$ --- instead your END

DELIMITER ;

Sign up to request clarification or add additional context in comments.

1 Comment

so instead of in_Customer_id it should just be Customer_id?
0

It seems like you missed the parameters names. Also you are not need to specify IN for params.

DELIMITER $$
Create Procedure Sp_insertCustomer(
Customer_id VARCHAR(20) ,
UserName VARCHAR(20), 
Fname VARCHAR(20), 
Lname VARCHAR(20), 
Dob Date, 
Address VARCHAR(250),
Phone INT,
Email VARCHAR(250), 
Ss VARCHAR(9) )
BEGIN
INSERT INTO Customer (Cusomter_id, UserName, Fname, Lname, Dob, Address, Phone, Email, Ss) 
VALUES (Customer_id, UserName, Fname, Lname, Dob, Address, Phone, Email, Ss);
END$$

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.