DROP PROCEDURE IF EXISTS mocha_get_instance_by_key;

CREATE PROCEDURE mocha_get_instance_by_key
(
    IN p_class_id INT,
    IN p_inst_id INT
)
BEGIN
    
    DECLARE p_tenant_id INT;
    SET p_tenant_id = mocha_get_current_tenant();

    SELECT * FROM mocha_instances
    WHERE tenant_id = p_tenant_id
    AND class_id = p_class_id
    AND inst_id = p_inst_id;

END;
