DELIMITER //

CREATE FUNCTION IF NOT EXISTS omc_get_dict_value(field_value VARCHAR(255), type VARCHAR(255))
RETURNS VARCHAR(255)
DETERMINISTIC
BEGIN
DECLARE result VARCHAR(255);

SELECT `dict_value` INTO result
FROM  `sys_dict_data`
WHERE `dict_label` = field_value AND `dict_type` = type limit 1;

RETURN result;
END //

DELIMITER;