我有以下程序。但我没有得到预期的结果。
CREATE PROCEDURE `getHierarchy` (IN selectedValue LONGTEXT, IN selectedLevel VARCHAR(30))
CASE selectedLevel
WHEN 'department' THEN
SELECT department_key,department,class_key,modified_class,subclass_key,modified_subclass,product_key,product_name FROM dim_product where department_key in (selectedValue) ORDER BY department_key,class_key,subclass_key,product_key;
WHEN 'class' THEN
SELECT department_key,department,class_key,modified_class,subclass_key,modified_subclass,product_key,product_name FROM dim_product where class_key in (selectedValue) ORDER BY department_key,class_key,subclass_key,product_key;
WHEN 'subclass' THEN
SELECT department_key,department,class_key,modified_class,subclass_key,modified_subclass,product_key,product_name FROM dim_product where subclass_key in (selectedValue) ORDER BY department_key,class_key,subclass_key,product_key;
END CASE;
END
以下电话仅提供 1 个详细信息:
call getHierarchy("1,2",'subclass');