Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Creating and Using SPL Routines > Returning Values from an SPL Function >

Returning a Single Value

Figure 415 shows how an SPL function can return a single value.

Figure 415.
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.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]