1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.8 2001/03/25 10:16:12 petere Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.9 2001/04/30 22:22:34 tgl Exp $
3
3
-->
4
4
5
5
<chapter id="pltcl">
@@ -96,8 +96,10 @@ CREATE FUNCTION <replaceable>funcname</replaceable> (<replaceable>argument-types
96
96
</programlisting>
97
97
98
98
When the function is called, the arguments are given as
99
- variables $1 ... $n to the Tcl procedure body. For example,
100
- a function
99
+ variables <literal>$1</literal> ... <literal>$n</literal> to the
100
+ Tcl procedure body. The result is returned
101
+ from the Tcl code in the usual way, with a <literal>return</literal>
102
+ statement. For example, a function
101
103
returning the higher of two int4 values could be defined as:
102
104
103
105
<programlisting>
@@ -107,6 +109,11 @@ CREATE FUNCTION tcl_max (int4, int4) RETURNS int4 AS '
107
109
' LANGUAGE 'pltcl';
108
110
</programlisting>
109
111
112
+ To return a NULL value from a PL/Tcl function, execute
113
+ <literal>return_null</literal>.
114
+ </para>
115
+
116
+ <para>
110
117
Composite type arguments are given to the procedure as Tcl arrays.
111
118
The element names
112
119
in the array are the attribute names of the composite