bank account:
<programlisting>
-CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$
+CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
UPDATE bank
SET balance = balance - debit
WHERE accountno = tf1.accountno;
is:
<programlisting>
-CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$
+CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
UPDATE bank
SET balance = balance - debit
WHERE accountno = tf1.accountno;
The same thing could be done in one command using <literal>RETURNING</>:
<programlisting>
-CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$
+CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
UPDATE bank
SET balance = balance - debit
WHERE accountno = tf1.accountno