How to create function that returns nothing

前端 未结 2 1406
忘掉有多难
忘掉有多难 2021-02-01 00:15

I want to write a function with pl/pgsql. I\'m using PostgresEnterprise Manager v3 and using shell to make a function, but in the shell I must define retu

2条回答
  •  花落未央
    2021-02-01 00:36

    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;
    

提交回复
热议问题