Concept Flow - CASE in PL/pgSQL
Start
Evaluate CASE expression or conditions
Match WHEN condition?
No→Check next WHEN
Yes
Execute THEN result
Exit CASE
If no WHEN matched, execute ELSE (optional)
End CASE
The CASE statement checks conditions one by one and executes the matching THEN part, or ELSE if no match.