mike davis <mike.davis65@xxxxxxxxxxx> writes: > I'm trying to get dynamic version of the RAISE command working so > that I can use a table of custom application error messages and codes > for use by all developed plpgsql functions. This works for me: DO $$ DECLARE v_msg TEXT := 'SOMETHING IS WRONG'; v_sqlstate TEXT := 'E0001'; BEGIN RAISE EXCEPTION USING message = v_msg, errcode = v_sqlstate; EXCEPTION WHEN SQLSTATE 'E0001' THEN RAISE NOTICE '%','Error E0001 raised - going to do something about it'; WHEN OTHERS THEN RAISE NOTICE 'OTHER ERRORS: %,%', sqlstate,sqlerrm; END$$; NOTICE: Error E0001 raised - going to do something about it Or you could do RAISE EXCEPTION SQLSTATE v_sqlstate USING message = v_msg; regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general