Skip to content
Advertisement

postgres procedure list of values

I’m trying to pass in a list of values into a Postgres 11 procedure. The query has an IN condition. How do I pass in a list of values to the procedure & then how do I use it in the query?

Advertisement

Answer

IN expects a list of values, while you are giving it a string.

If you can change the datatype of the argument to the procedure, then it would be simpler to use an array:

If you can’t change the argument of the datatype, then another option uses string_to_array() to parse the string as an array:

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