I am following the other topic, but unfortunately i couldn’t comment on that as i don’t meet requirement to comment (less reputation). If someone can help me, i really appreciate it.
topic is here
text
Let’s say i have 2 variables here
psql ...... -v v1=50 -v v2=100
I know that using only 1 variable will work fine
SELECT format($$
DO
$do$
DECLARE
_number1 numeric := %L;
BEGIN
RAISE NOTICE '%%', _number1;
END
$do$;
$$, :'v1',:'v2')gexec
But how to deal with many variables ? I tried to run it like this but not sure if it is correct or not.
SELECT format($$
DO
$do$
DECLARE
_number1 numeric := %L;
_number2 numeric := %L;
BEGIN
RAISE NOTICE '%%', _number1;
RAISE NOTICE '%%', _number2;
END
$do$;
$$, :'v1',:'v2')gexec