1
I created a function in Postgresql where I sum certain accounts. However, my function has only one parameter for them:
f_retorna_somatorio(p_conta character varying, p_cnpj character varying, p_ano_mes character varying)
The parameter "p_account", needs to receive three values: 300001, 300002, 300003
I will use this inside an IN. Whenever I select in the function it is returning me 0 because of a coalesce.
Does anyone know how to make that passage?
Note: I tried the following example already and it didn’t work:
f_retorna_somatorio($$'300001','300002','300003'$$, '00000000000000', '0000-00')
Tried calling with '300001,300002,300003'?
– anonimo
Another possibility is, within its function, to mount the string of its query and execute it using EXECUTE. https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
– anonimo