Call function in select statement : Function Call « Store Procedure Function « PostgreSQL






Call function in select statement


postgres=# CREATE FUNCTION "test" (integer) RETURNS integer AS '
postgres'#
postgres'#  DECLARE
postgres'#   variable ALIAS FOR $1;
postgres'#  BEGIN
postgres'#   return variable * 2;
postgres'#  END;
postgres'#  ' LANGUAGE 'plpgsql';
CREATE FUNCTION
postgres=#
postgres=# select test(1);
 test
------
    2
(1 row)

postgres=#
postgres=# drop function test(integer);
DROP FUNCTION
postgres=#
postgres=#
           
       








Related examples in the same category