缺少右括号

时间:2016-09-15 16:42:57

标签: mysql sql stored-procedures

我正在将此存储过程从mssql移植到mysql,并且收到错误消息,说我错过了右括号,我似乎无法找到原因。

CREATE PROCEDURE get_oids (IN sys_info VARCHAR(255))
BEGIN
    SELECT oids.id, oids.attribute, oids.description_oid, oids.mib_name, oids.classifier  
    FROM oids
    INNER JOIN mib_mappings 
        ON mib_mappings.name = oids.mib_name
    WHERE ((sys_info LIKE '%' + mib_mappings.model + '%' AND sys_info LIKE '%' + mib_mappings.vendor + '%') OR mib_mappings.model = 'ALL')
        AND oids.nodeType = 'CHILD' AND oids.descriptionOID is not null
    GROUP BY oids.id, oids.attribute, oids.description_oid, oids.mib_name, o.classifier
END

1 个答案:

答案 0 :(得分:0)

请你检查一下,我认为问题出在同一组和组末尾的分号:

CREATE PROCEDURE get_oids (IN sys_info VARCHAR(255))
BEGIN
SELECT oids.id, 
    oids.attribute, 
    oids.description_oid, 
    oids.mib_name, 
    oids.classifier  
FROM oids
INNER JOIN mib_mappings ON mib_mappings.name = oids.mib_name
WHERE ((sys_info LIKE CONCAT('%',mib_mappings.model,'%') 
    AND sys_info LIKE CONCAT('%',mib_mappings.vendor,'%') 
    OR mib_mappings.model = 'ALL')
    AND oids.nodeType = 'CHILD' 
    AND oids.descriptionOID IS NOT NULL
GROUP BY oids.id, oids.attribute, oids.description_oid, oids.mib_name, o.classifier;
END