Thread: How do Exception, do nothing and carry on
The function in the following block code may fail.
How to make it to carry on by ignoring exception?
Something like Python's try catch.
for i in (select distinct id from id_table)
loop
raise notice '%', i;
insert into my_table(id, last, arr, count) SELECT i, * from my_function(i) f(last int, arr int[], count int);
commit;
end loop;
On Thursday, July 6, 2023, Shaozhong SHI <shishaozhong@gmail.com> wrote:
The function in the following block code may fail.How to make it to carry on by ignoring exception?Something like Python's try catch.for i in (select distinct id from id_table)loopraise notice '%', i;insert into my_table(id, last, arr, count) SELECT i, * from my_function(i) f(last int, arr int[], count int);commit;end loop;
Create a new function that traps [1] the failure and throws it away, then call that function instead.
David J.