Figure 415 shows how an SPL function can return a single value.
CREATE FUNCTION increase_by_pct(amt DECIMAL, pct DECIMAL) RETURNING DECIMAL; DEFINE result DECIMAL; LET result = amt + amt * (pct/100); RETURN result; END FUNCTION;
The increase_by_pct function receives two arguments of DECIMAL value, an amount to be increased and a percentage by which to increase it. The return clause specifies that the function will return one DECIMAL value. The RETURN statement returns the DECIMAL value stored in result.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]