CREATE PROCEDURE temp (IN empId INT)
        BEGIN
         DECLARE emptype VARCHAR;
            SELECT emptype = qoute(emptype) FROM dms_document WHERE id =  empid;
                SELECT emptype,

     CASE
    WHEN emptype = 'P' THEN doctype;

    ELSE 'No Documents required';
    END CASE ;
    FROM dms_report WHERE pilot = 1
End;


我正在尝试在sql工作台中创建过程,但出现了关键字Error。为什么会出现此错误,请帮忙。

最佳答案

DELIMITER //
CREATE PROCEDURE temp ( empId INT)
    BEGIN
     DECLARE var_etype VARCHAR(36);

SELECT
    emptype = QOUTE(emptype)
FROM
    dms_document
WHERE
    id = empid;
SELECT
    emptype,
    CASE
        WHEN emptype = 'P' THEN doctype
        ELSE 'No Documents required'
    END
FROM
    dms_report
WHERE
    pilot = 1;
End//
DELIMITER ;


运行这个,享受!!!

关于java - 在我的SQL工作台中创建过程时出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31086749/

10-12 04:57