MySQL存储过程的问题

时间:2018-04-06 14:23:09

标签: mysql stored-procedures

我的程序没有被创建...给出错误

[SQL]CREATE DEFINER = `root``%` PROCEDURE `sp_getemployee`(IN  _ulbid    INT , IN  _designationid    INT)
BEGIN
DECLARE queryString VARCHAR(500);
[Err] 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 3

SP就是这样的。

    CREATE DEFINER = `root``%` PROCEDURE `sp_getemployee`(IN  _ulbid    INT , IN  _designationid    INT)

BEGIN

DECLARE queryString VARCHAR(500);

SET queryString = CONCAT('select 
empid,empnumber,designationid,namee,namer,mobileno,isactive from employee where ulbid= ', _ulbid);

IF _designationid != 0 THEN 

  SET queryString = CONCAT(queryString , ' and designationid= ', _designationid);

END IF;

PREPARE stmt FROM queryString;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END;

绝对不知道我哪里出错了,有人可以帮我解决一下

0 个答案:

没有答案