Two out parameters : Function Parameter « Store Procedure Function « PostgreSQL






Two out parameters


postgres=#
postgres=# CREATE FUNCTION dup (f1 anyelement, OUT f2 anyelement, OUT f3 anyarray)
postgres-# AS 'select $1, array[$1,$1]' LANGUAGE sql;
CREATE FUNCTION
postgres=#
postgres=# SELECT * FROM dup(22);
    REATE
 f2 |   f3
----+---------
 22 | {22,22}
(1 row)

postgres=#
postgres=# drop function dup(f1 anyelement, OUT f2 anyelement, OUT f3 anyarray);
postgres=#
postgres=#
           
       








Related examples in the same category

1.Here the $1 references the value of the first function argument whenever the function is invoked
2.Pass constant to function
3.OUT parameter
4.Output parameters are most useful when returning multiple values
5.Real number parameter
6.'Anyelement' parameter
7.Pass in a whole row
8.Use defined data type as the function parameter