PostgreSQL/Store Procedure Function/Function Call

Материал из SQL эксперт
Перейти к: навигация, поиск

Call function in select statement

   <source lang="sql">

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=#

      </source>