File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -302,7 +302,7 @@ SELECT add_em(1, 2) AS answer;
302
302
bank account:
303
303
304
304
<programlisting>
305
- CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$
305
+ CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
306
306
UPDATE bank
307
307
SET balance = balance - debit
308
308
WHERE accountno = tf1.accountno;
@@ -333,7 +333,7 @@ SELECT tf1(17, 100.0);
333
333
is:
334
334
335
335
<programlisting>
336
- CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$
336
+ CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
337
337
UPDATE bank
338
338
SET balance = balance - debit
339
339
WHERE accountno = tf1.accountno;
@@ -345,7 +345,7 @@ $$ LANGUAGE SQL;
345
345
The same thing could be done in one command using <literal>RETURNING</>:
346
346
347
347
<programlisting>
348
- CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$
348
+ CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
349
349
UPDATE bank
350
350
SET balance = balance - debit
351
351
WHERE accountno = tf1.accountno
You can’t perform that action at this time.
0 commit comments