I'm working in a psql database and I want to leave something running overnight.
I have a function I am calling like this:
select func_name(21);
This function is transactionalised and once ran, inserts to the DB.
I then want to run the same function again (it has highwater marks, so it will know where to pick up from):
select func_name(21);
Lets say I want to run this 10 times - is this possible?
I had considered using something like gexec
but unsure how to make it work.
I can get the following:
select format('select func_name(%s)',id) from table where id = '21';
format
--------------------------------------------
select func_name(21)
(1 row)
I know if I execute this using gexec
it will run once but is there a way I can get it to run ten times without using a loop within another function?
question from:
https://stackoverflow.com/questions/65835438/run-query-again-once-finished-n-times 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…