I'm trying to find the most efficient way to concatenate text in PL/SQL. My system scans five variables, and does something along these lines:
return_value := ''
IF variable_a is null THEN
return_value := 'Error: Variable A null';
END IF;
IF variable_b is null THEN
IF return_value = '' THEN
return_value := 'Error: Variable B null';
ELSE
return_value := return_value || ', Variable B null';
END IF;
IF variable_c is null THEN
IF return_value = '' THEN
return_value := 'Error: Variable C null';
ELSE
return_value := return_value || ', Variable c null';
END IF;
etc.
Hopefully the logic of what I'm trying to do is clear - determine if any of the five variables are null and concatenate the text of each error message to the return value, so by the end of the bunch of if/else statements the return value is either null (good) or contains an error call (bad).
Is there a better way to do this though? It seems rather lengthy and I feel, as a PL/SQL newbie, I'm missing some obvious way of doing this in a much more efficient, shorter manner.