DorkMonstuh DorkMonstuh - 2 months ago 19
MySQL Question

missing closing parenthesis

I am porting this stored procedure over from mssql to mysql and am getting an error saying that I am missing closing parenthesis which I cannot seem to find why.

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

Answer

Can you please check with it, I think the problem is with like and the missing semicolon at the end of group by:

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
Comments