DROP FUNCTION IF EXISTS mocha_get_tenant_by_name;

CREATE FUNCTION mocha_get_tenant_by_name
(
    p_tenant_name VARCHAR(32)
)
RETURNS INT
RETURN (SELECT id FROM mocha_tenants WHERE tenant_name = p_tenant_name LIMIT 1);