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.
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.
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).