mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
Example for create function using argument names
Gavin Sherry
This commit is contained in:
parent
af4de81469
commit
cf9fd800ec
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_function.sgml,v 1.57 2004/06/25 07:05:34 dennis Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/ref/create_function.sgml,v 1.58 2004/07/11 23:23:43 momjian Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<refentry id="SQL-CREATEFUNCTION">
|
<refentry id="SQL-CREATEFUNCTION">
|
||||||
@ -398,6 +398,17 @@ CREATE FUNCTION add(integer, integer) RETURNS integer
|
|||||||
LANGUAGE SQL
|
LANGUAGE SQL
|
||||||
IMMUTABLE
|
IMMUTABLE
|
||||||
RETURNS NULL ON NULL INPUT;
|
RETURNS NULL ON NULL INPUT;
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Increment an integer, making use of an argument name, in PL/PgSQL:
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
CREATE OR REPLACE FUNCTION increment(i integer) RETURNS integer AS '
|
||||||
|
BEGIN
|
||||||
|
RETURN i + 1;
|
||||||
|
END;' LANGUAGE plpgsql;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user