drop function if exists casefunction // create function casefunction(p_comp VARCHAR(10),p_divi VARCHAR(10)) returns VARCHAR(10) begin declare l_value VARCHAR(30); case when p_comp = 'ACME' and p_divi = 'HR' then set l_value := 'It was ACME and HR'; when p_comp = 'ACME' and p_divi = 'IT' then set l_value := 'It was ACME and IT'; when p_comp = 'CORP' and p_divi = 'HR' then set l_value := 'It was CORP and HR'; when p_comp = 'CORP' and p_divi = 'IT' then set l_value := 'It was CORP and IT'; end case; return l_value; end //