I am working with Postgres 10.7. In my application, I want to update a table on a daily basis as an automated schedule.
I have created a function for this (not the schedule but the code I want to execute). Function compiles and runs successfully but does not update the columns when executed. This is my function.
CREATE or replace function updateProdDaily() returns void AS $ func$ BEGIN UPDATE products_table SET trxn_cnt =: 0; EXCEPTION WHEN OTHERS THEN raise notice '% %', SQLERRM, SQLSTATE; END; $ func$ LANGUAGE plpgsql;
This is how I execute it.
Can someone point out if there is a problem with the function please?
Also how would I schedule this function to run on a daily basis?
DO $ $ BEGIN PERFORM updateProdDaily(); commit; EXCEPTION WHEN OTHERS THEN raise notice '% %', SQLERRM, SQLSTATE; END $ $ ;