--- plpgsql.sgml.orig Mon Dec 22 16:27:50 2003 +++ plpgsql.sgml Mon Dec 22 16:38:48 2003 @@ -572,7 +572,7 @@ the function, so it can be used to hold the return value if desired, though that is not required. $0 can also be given an alias. For example, this function works on any data type - that has a + operator: + that has a + operator: CREATE FUNCTION add_three_values(anyelement, anyelement, anyelement) RETURNS anyelement AS ' @@ -588,6 +588,28 @@ ' LANGUAGE plpgsql; + + + Note that it is not possible to assign function arguments during + a DECLARE block. You must first declare your + variables, and then assign to them from within a BEGIN + block. + + +CREATE FUNCTION concat_int_and_char(integer, char(2)) +RETURNS text AS ' +DECLARE + my_int integer; + my_char char(2); +BEGIN + my_int := $1; + my_char := $2; + return (my_int || my_char)::text; +END; +' LANGUAGE plpgsql; + + +