2021年1月6日星期三

Ignore an error that occurs in a redshift stored procedure

I need to ignore an error when running a proc, but the error still seems to propagate. Is it possible to just swallow it somehow?

CREATE OR REPLACE PROCEDURE myproc()  AS $$  BEGIN    EXECUTE 'bad_statement;';  EXCEPTION WHEN OTHERS THEN      NULL;  END;  $$ LANGUAGE plpgsql;  

Then

call myproc();  

Gives you:

[2021-01-06 17:08:42] [42601][500310] [Amazon](500310) Invalid operation: syntax error at or near "bad_statement";  

Tested it in postgres and it ignores the error correctly.

https://stackoverflow.com/questions/65604014/ignore-an-error-that-occurs-in-a-redshift-stored-procedure January 07, 2021 at 06:09AM

没有评论:

发表评论