PostgreSQL/Store Procedure Function/Function Call — различия между версиями

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

Версия 16:45, 26 мая 2010

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>