How to create function that returns nothing How to create function that returns nothing postgresql postgresql

How to create function that returns nothing


Use RETURNS void like below:

CREATE FUNCTION stamp_user(id int, comment text) RETURNS void AS $$    #variable_conflict use_variable    DECLARE        curtime timestamp := now();    BEGIN        UPDATE users SET last_modified = curtime, comment = comment          WHERE users.id = id;    END;$$ LANGUAGE plpgsql;


Functions must always return something, although you can use procedures like

do $$

and start with normal function like

declare...

but if you still want to do a function just add void after returns.