mocha/sql/mysql/000-functions/mocha_get_instance_by_global_identifier.sql
2023-11-26 23:31:32 -05:00

8 lines
344 B
SQL

DROP FUNCTION IF EXISTS mocha_get_instance_by_global_identifier;
CREATE FUNCTION mocha_get_instance_by_global_identifier
(
p_global_identifier CHAR(40)
)
RETURNS INT
RETURN (SELECT id FROM mocha_instances WHERE tenant_id = mocha_get_current_tenant() AND UPPER(global_identifier) = UPPER(mocha_normalize_uuid(p_global_identifier)) LIMIT 1);