In a procedure, I need to decide about the value of a column using many if-else conditions. The script starts with a
FOR rec IN (SELECT....) LOOP Begin
and decides on many different values the rec sub-records can obtain in each iteration. for some cases, there might be just 2 or 3 variable assignments and some cases include running a separate procedure or doing an INSERT operation.
Does this approach the best approach for decision making from the aspect of performance where there are many records as the result of loop's SELECT statement, or there might be better alternatives? What if I adapt Chain-of-responsibility pattern in writing this procedure? Will this approach increase performance or just makes things even worse?
Regards.