I wrote a MySQL stored procedure:
我写了一个MySQL存储过程:
CREATE PROCEDURE add_Customer
(
IN p_customer_id INT(11) ,
IN p_Email VARCHAR(70) ,
IN p_password VARCHAR(15) ,
IN p_firstname VARCHAR(40) ,
IN p_lastname VARCHAR(40) ,
IN p_birth_date DATE ,
IN p_gender VARCHAR(20) ,
IN p_address_1 VARCHAR(200) ,
IN p_address_2 VARCHAR(200) ,
IN p_city VARCHAR(40) ,
IN p_state VARCHAR(40) ,
IN p_country VARCHAR(50) ,
IN p_phoneNumber VARCHAR(20) ,
IN p_postalcode VARCHAR(10) ,
IN p_billingAddress VARCHAR(200) ,
IN p_billingCity VARCHAR(60) ,
IN p_billingCountry VARCHAR(70) ,
IN p_billingState VARCHAR(70) ,
IN p_billing_Zip_code VARCHAR(15) ,
IN p_shippingAddress VARCHAR(250) ,
IN p_shippingCity VARCHAR(50) ,
IN p_shippingCountry VARCHAR(60) ,
IN p_shippingState VARCHAR(60) ,
IN p_shipping_zip_code VARCHAR(15) ,
IN p_credit_card_number VARCHAR(20) ,
IN p_name_on_creditCard VARCHAR(70) ,
IN p_credit_card_type VARCHAR(20) ,
IN p_cardSecurityCode INT(4) ,
IN p_card_exp_date DATE ,
IN p_K_net_account VARCHAR(40) ,
IN p_account_status VARCHAR(30) ,
IN p_email_verified VARCHAR(20) ,
IN p_registration_date DATE ,
IN p_verification_code VARCHAR(20) ,
IN p_last_login TIMESTAMP )
BEGIN
INSERT INTO customer
(
CustomerID ,
CustomerEmail ,
CustomerPassword ,
FirstName ,
LastName ,
DateOfBirth ,
Gender ,
Address_1 ,
Address_2 ,
City ,
Region ,
Country ,
PhoneNumber ,
PostalCode ,
BillingAddress ,
BillingCity ,
BillingState ,
BillingCountry ,
BillingPostalCode ,
ShippingAddress ,
ShippingCity ,
ShippingState ,
ShippingCountry ,
ShippingPostalCode ,
CreditCardType ,
CreditCardNumber ,
NameOnCreditCard ,
CardSecurityCode ,
CardExpDate ,
K_NetAccount ,
AccountStatus ,
VerivecationCode ,
EmailVerified ,
RegistrationDate ,
LastLogin ,
)
VALUES
(
p_customer_id ,
p_Email ,
p_password ,
p_firstname ,
p_lastname ,
p_birth_date ,
p_gender ,
p_address_1 ,
p_address_2 ,
p_city ,
p_state ,
p_country ,
p_phoneNumber ,
p_postalcode ,
p_billingAddress ,
p_billingCity ,
p_billingState ,
p_billingCountry ,
p_billing_Zip_code ,
p_shippingAddress ,
p_shippingCity ,
p_shippingState ,
p_shippingCountry ,
p_shipping_zip_code ,
p_credit_card_type ,
p_credit_card_number ,
p_name_on_creditCard ,
p_cardSecurityCode ,
p_card_exp_date ,
p_K_net_account ,
p_account_status ,
p_verification_code ,
p_email_verified ,
p_registration_date ,
p_last_login )
END
and when execute it shows this message
并在执行时显示此消息
" #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 ') VALUES ( p_customer_id ' at line 80"
“#1064 - 您的SQL语法有错误;请查看与您的MySQL服务器版本对应的手册,以便在附近使用正确的语法')VALUES(第80行的p_customer_id')
How can I fix it?
我该如何解决?
2 个解决方案
#1
1
You have a redundant comma (,
) before the closing brackets ()
) in the columns clause.
在columns子句中,在结束括号()之前有一个冗余逗号(,)。
INSERT INTO customer
(
CustomerID ,
CustomerEmail ,
CustomerPassword ,
FirstName ,
LastName ,
DateOfBirth ,
Gender ,
Address_1 ,
Address_2 ,
City ,
Region ,
Country ,
PhoneNumber ,
PostalCode ,
BillingAddress ,
BillingCity ,
BillingState ,
BillingCountry ,
BillingPostalCode ,
ShippingAddress ,
ShippingCity ,
ShippingState ,
ShippingCountry ,
ShippingPostalCode ,
CreditCardType ,
CreditCardNumber ,
NameOnCreditCard ,
CardSecurityCode ,
CardExpDate ,
K_NetAccount ,
AccountStatus ,
VerivecationCode ,
EmailVerified ,
RegistrationDate ,
LastLogin -- Comma removed here
)
VALUES
-- Snipped
#2
0
Remove the trailing ",
" (comma) in
删除尾随的“,”(逗号)
LastLogin ,
^
|
#1
1
You have a redundant comma (,
) before the closing brackets ()
) in the columns clause.
在columns子句中,在结束括号()之前有一个冗余逗号(,)。
INSERT INTO customer
(
CustomerID ,
CustomerEmail ,
CustomerPassword ,
FirstName ,
LastName ,
DateOfBirth ,
Gender ,
Address_1 ,
Address_2 ,
City ,
Region ,
Country ,
PhoneNumber ,
PostalCode ,
BillingAddress ,
BillingCity ,
BillingState ,
BillingCountry ,
BillingPostalCode ,
ShippingAddress ,
ShippingCity ,
ShippingState ,
ShippingCountry ,
ShippingPostalCode ,
CreditCardType ,
CreditCardNumber ,
NameOnCreditCard ,
CardSecurityCode ,
CardExpDate ,
K_NetAccount ,
AccountStatus ,
VerivecationCode ,
EmailVerified ,
RegistrationDate ,
LastLogin -- Comma removed here
)
VALUES
-- Snipped
#2
0
Remove the trailing ",
" (comma) in
删除尾随的“,”(逗号)
LastLogin ,
^
|