我是mysql的新手,我正在尝试创建一个存储过程,但由于声明了一个变量而导致语法错误。 我正在使用的mysql版本是5.5.43,我的程序是:
CREATE PROCEDURE spSearch
(
p_ACTION INT,
p_PROJECT_CUSTOMER INT,
p_PROJECT_NAME VARCHAR(50),
p_PROJECT_SALESPERSON INT,
p_PROJECT_MANAGER INT,
p_PROJECT_PMF INT,
p_PROJECT_TYPE INT,
p_PROJECT_DESIGNER INT,
p_PROJECT_AANDD INT,
p_PROJECT_REFD INT,
p_PROJECT_VENDOR INT,
p_PROJECT_GENERALCONTRACTOR INT,
p_PROJECT_PUNCHLIST varchar(1),
p_PROJECT_LOCATION INT,
p_PROJECT_CLIENTTYPE INT,
p_PROJECT_INSTALLDATE VARCHAR(50),
p_PROJECT_INSTALLDATETO VARCHAR(50),
p_PROJECT_ORDERENTRYDATE VARCHAR(50),
p_PROJECT_ORDERENTRYDATETO VARCHAR(50),
p_PROJECT_MOVEINDATE VARCHAR(50),
p_PROJECT_MOVEINDATETO VARCHAR(50),
p_PROJECT_ACTIVE_FLAG VARCHAR(1)
)
BEGIN
DECLARE ABC VARCHAR(1400);
END;
我收到了这个错误:
#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 28
请帮助删除此语法错误。
答案 0 :(得分:0)
您的分隔符似乎有问题。试试这个:
delimiter //
CREATE PROCEDURE spSearch
(
p_ACTION INT,
p_PROJECT_CUSTOMER INT,
p_PROJECT_NAME VARCHAR(50),
p_PROJECT_SALESPERSON INT,
p_PROJECT_MANAGER INT,
p_PROJECT_PMF INT,
p_PROJECT_TYPE INT,
p_PROJECT_DESIGNER INT,
p_PROJECT_AANDD INT,
p_PROJECT_REFD INT,
p_PROJECT_VENDOR INT,
p_PROJECT_GENERALCONTRACTOR INT,
p_PROJECT_PUNCHLIST varchar(1),
p_PROJECT_LOCATION INT,
p_PROJECT_CLIENTTYPE INT,
p_PROJECT_INSTALLDATE VARCHAR(50),
p_PROJECT_INSTALLDATETO VARCHAR(50),
p_PROJECT_ORDERENTRYDATE VARCHAR(50),
p_PROJECT_ORDERENTRYDATETO VARCHAR(50),
p_PROJECT_MOVEINDATE VARCHAR(50),
p_PROJECT_MOVEINDATETO VARCHAR(50),
p_PROJECT_ACTIVE_FLAG VARCHAR(1)
)
BEGIN
DECLARE ABC VARCHAR(1400);
END//
delimiter ;