I am just wondering how to store a list of integers as a variable in PostreSQL stored procedure.
For example, I have statements like these:
select A from B where C IN (1,2,3);
select A from B where C IN (1,2);
And I want to declare a variable to store (1,2,3)
or (1,2)
.
So I would end up with a statement like:
select A from B where C in numberList;
(numberList has the value (1,2,3))
I don't know which datatype I should use,I looked up online and can't find there is a list type in psql. And what's the syntax for that as well?