Skip to content
Advertisement

Building query in PL/pgsql with different columns based on flag

I need to run the following statement in PL/pgSQL.

How can I avoid repeating repeating myself in this code?

Advertisement

Answer

Try creating variable cols with default values columnA,columnB and then contatenate it with columnC in case you need it, e.g.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement