delimiter //
DROP PROCEDURE IF EXISTS DIAGNOSIS; //
CREATE PROCEDURE DIAGNOSIS(IN SYM INT, IN DISE VARCHAR(255))
BEGIN
DECLARE I INT DEFAULT 1;
DECLARE SYM_COL VARCHAR(50);
DECLARE N INT DEFAULT 1;
DECLARE C INT DEFAULT 1;
DECLARE ST VARCHAR(255);
DECLARE DID INT;
CREATE TEMPORARY TABLE SYM_TEMP (SID INT, SNAME VARCHAR(50));
CREATE TEMPORARY TABLE DISE_TEMP (DID INT, DNAME VARCHAR(100));
--error stating problem with syntax!!!
IF DISE = '' THEN
SET SYM_COL = (SELECT SNAME FROM SYMPTOMS WHERE SID = SYM);
--other set of codes
END IF;
END//
delimiter ;
答案 0 :(得分:1)
在更改分隔符时,从DROP PROCEDURE语句中删除分号 像这样的东西:
delimiter //
DROP PROCEDURE IF EXISTS DIAGNOSIS //
CREATE PROCEDURE DIAGNOSIS(IN SYM INT, IN DISE VARCHAR(255))
BEGIN
DECLARE I INT DEFAULT 1;
DECLARE SYM_COL VARCHAR(50);
DECLARE N INT DEFAULT 1;
DECLARE C INT DEFAULT 1;
DECLARE ST VARCHAR(255);
DECLARE DID INT;
CREATE TEMPORARY TABLE SYM_TEMP (SID INT, SNAME VARCHAR(50));
CREATE TEMPORARY TABLE DISE_TEMP (DID INT, DNAME VARCHAR(100));
--error stating problem with syntax!!!
IF DISE = '' THEN
SET SYM_COL = (SELECT SNAME FROM SYMPTOMS WHERE SID = SYM);
--other set of codes
END IF;
END//
delimiter ;
我相信其他代码很好