PostgreSQL/Store Procedure Function/Input Alias

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

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>