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?
create or replace procedure some_procedure(
source_id_list character varying <-- is this correct?
)
language plpgsql
as $$
declare
result_count int;
begin
select count(*)
into result_count
from table sd
where sd.id in source_id_list <-- syntax error
;
RAISE NOTICE 'result: %', result_count;
end;
$$
INaccepts a list of values, you are giving it a string. Why not use an array as an argument to the function instead?