I would like to evaluate the expression of a CASE statement (which is the value returned from a function) and if it does not meet one of the conditions return the expression value itself.
For instance:
CASE UPDATE_RECORDS_F(party_number)
WHEN 'ONE_RECORD_UPDATED' THEN RETURN 'OK';
WHEN 'MULTIPLE_RECORDS_UPDATED' THEN RETURN 'OK_MULTIPLE';
ELSE RETURN (expression value);
END CASE;
The 'else' case is needed for when an exception is thrown. I could assign the returned function value to a string and evaluate that, but I don't know how long an error message could be. I would rather handle the string value on the fly instead of creating a variable with a set length that could be exceeded.
Is there a way to do this?
RETURN CASE UPDATE_RECORDS(...) WHEN... THEN ... ..... END;(warning: in this case it'sEND, notEND CASE, since now you are using a CASE expression). Better to have oneRETURNstatement instead of three.