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

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

Текущая версия на 13:14, 26 мая 2010

Declare Input alias

   <source lang="sql">

postgres=# CREATE FUNCTION "triple_price" (double precision) RETURNS double precision AS " postgres"# DECLARE postgres"# -- Declare input_price as an alias for the postgres"# -- argument variable normally referenced with postgres"# -- the $1 identifier. postgres"# input_price ALIAS FOR $1; postgres"# postgres"# BEGIN postgres"# -- Return the input price multiplied by three. postgres"# RETURN input_price * 3; postgres"# END; postgres"# " LANGUAGE "plpgsql"; CREATE FUNCTION postgres=# postgres=# postgres=# select triple_price(100);

triple_price

         300

(1 row) postgres=#

      </source>