Skip to content

INOUT

CREATE FUNCTION add_one(INOUT x integer) AS
$$
BEGIN
x := x + 1;
END;
$$ LANGUAGE plpgsql;
SELECT add_one(5);
add_one
---------
6
(1 row)

In the example, a function called add_one is created with an INOUT parameter x. The function increases x by 1 each time it is called. When the function is called with 5 as the input, the function returns 6. This is what the Output represents.