Commit 0332993c authored by Peter Eisentraut's avatar Peter Eisentraut

doc: Improve types in example

Reported-by: default avatarNikolaus Thiel <klt@fsfe.org>
parent 0933fcee
...@@ -302,7 +302,7 @@ SELECT add_em(1, 2) AS answer; ...@@ -302,7 +302,7 @@ SELECT add_em(1, 2) AS answer;
bank account: bank account:
<programlisting> <programlisting>
CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$ CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
UPDATE bank UPDATE bank
SET balance = balance - debit SET balance = balance - debit
WHERE accountno = tf1.accountno; WHERE accountno = tf1.accountno;
...@@ -333,7 +333,7 @@ SELECT tf1(17, 100.0); ...@@ -333,7 +333,7 @@ SELECT tf1(17, 100.0);
is: is:
<programlisting> <programlisting>
CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$ CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
UPDATE bank UPDATE bank
SET balance = balance - debit SET balance = balance - debit
WHERE accountno = tf1.accountno; WHERE accountno = tf1.accountno;
...@@ -345,7 +345,7 @@ $$ LANGUAGE SQL; ...@@ -345,7 +345,7 @@ $$ LANGUAGE SQL;
The same thing could be done in one command using <literal>RETURNING</>: The same thing could be done in one command using <literal>RETURNING</>:
<programlisting> <programlisting>
CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$ CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
UPDATE bank UPDATE bank
SET balance = balance - debit SET balance = balance - debit
WHERE accountno = tf1.accountno WHERE accountno = tf1.accountno
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment