Til mig opgave med CASE-udtryk er lidt forvirrende (svært at læse), så jeg ville bruge CASE klausul med INTO @var i stedet:
BEGIN
CASE
WHEN vtable = 'daily_operation' THEN
SELECT start_time INTO @result FROM daily_operation WHERE (client_id = vclient_id AND user_id = vuser_id AND id = vid AND edition_id = vedition_id) LIMIT 1;
WHEN vtable = 'monthly_operation' THEN
SELECT start_time INTO @result FROM monthly_operation WHERE (client_id = vclient_id AND user_id = vuser_id AND id = vid AND edition_id = vedition_id) LIMIT 1;
END CASE;
RETURN @result;
END
Bemærk, du behøver ikke DEKLARE @session_variables brugt i SP.