Begin and end the routine

To create an SPL routine that does not return values, start with the CREATE PROCEDURE statement and end with the END PROCEDURE keyword. The following figure shows how to begin and end an SPL procedure.
Figure 1: Begin and end an SPL procedure.
CREATE PROCEDURE new_price( per_cent REAL )
. . .
END PROCEDURE;

For more information about naming conventions, see the Identifier segment in the HCL OneDB™ Guide to SQL: Syntax.

To create an SPL function that returns one or more values, start with the CREATE FUNCTION statement and end with the END FUNCTION keyword. The following figure shows how to begin and end an SPL function.
Figure 2: Begin and end an SPL function.
CREATE FUNCTION discount_price( per_cent REAL)
   RETURNING MONEY;
. . .
END FUNCTION;

In SPL routines, the END PROCEDURE or END FUNCTION keywords are required.

Important: For compatibility with earlier HCL OneDB products, you can use CREATE PROCEDURE with a RETURNING clause to create a user-defined routine that returns a value. Your code will be easier to read and to maintain, however, it you use CREATE PROCEDURE for SPL routines that do not return values (SPL procedures) and CREATE FUNCTION for SPL routines that return one or more values (SPL functions).