Functions with Output Parameters : Create Function « Store Procedure Function « PostgreSQL






Functions with Output Parameters


postgres=#
postgres=# -- Functions with Output Parameters
postgres=#
postgres=# CREATE FUNCTION add_em (IN x int, IN y int, OUT sum int)
postgres-# AS 'SELECT $1 + $2'
postgres-# LANGUAGE SQL;
CREATE FUNCTION
postgres=#
postgres=# SELECT add_em(3,7);
 REATE
 add_em
--------
     10
(1 row)

postgres=#
postgres=# drop function add_em(IN x int, IN y int, OUT sum int);
DROP FUNCTION
postgres=#
postgres=#
           
       








Related examples in the same category

1.Create a simeple function
2.Case insensitive
3.Add three parameters together in a function
4.Pass in entire table row to a function
5.The simplest possible SQL function has no arguments and simply returns a base type