DROP PROCEDURE IF EXISTS mocha_get_instance_by_global_identifier;

CREATE PROCEDURE mocha_get_instance_by_global_identifier
(
    IN p_tenant_id INT,
    IN p_global_identifier CHAR(32)
)
BEGIN

    SELECT * FROM mocha_instances
    WHERE tenant_id = p_tenant_id
    AND LOWER(global_identifier) = LOWER(p_global_identifier);

END;
