Kind people,
Please find enclosed this patch from Alex J. Avriette :)
Cheers,
D
--
David Fetter [EMAIL PROTECTED] http://fetter.org/
phone: +1 510 893 6100 cell: +1 415 235 3778
--- 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. <literal>$0</> can also be
given an alias. For example, this function works on any data type
- that has a <literal>+</> operator:
+ that has a <literal>+</> operator:
<programlisting>
CREATE FUNCTION add_three_values(anyelement, anyelement, anyelement)
RETURNS anyelement AS '
@@ -588,6 +588,28 @@
' LANGUAGE plpgsql;
</programlisting>
</para>
+
+ <para>
+ Note that it is not possible to assign function arguments during
+ a <literal>DECLARE</> block. You must first declare your
+ variables, and then assign to them from within a <literal>BEGIN</>
+ block.
+
+<programlisting>
+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;
+</programlisting>
+ </para>
+
</sect2>
<sect2 id="plpgsql-declaration-type">
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html