Declare PROCEDURE type variables

In an SPL routine, you can define a variable of type PROCEDURE and assign the variable the name of an existing SPL routine or external routine. Defining a variable of PROCEDURE type indicates that the variable is a call to a user-defined routine, not a built-in routine of the same name.

For example, the statement in the following figure defines length as an SPL procedure or SPL function, not as the built-in LENGTH function.
Figure 1: Define length as an SPL procedure.
DEFINE length PROCEDURE;
LET x = length( a,b,c );

This definition disables the built-in LENGTH function within the scope of the statement block. You would use such a definition if you had already created an SPL or external routine with the name LENGTH.

Because HCL OneDB™ supports routine overloading, you can define more than one SPL routine or external routine with the same name. If you call any routine from an SPL routine, HCL OneDB determines which routine to use, based on the arguments specified and the routine determination rules. For information about routine overloading and routine determination, see HCL OneDB User-Defined Routines and Data Types Developer's Guide.

Tip: If you create an SPL routine with the same name as an aggregate function (SUM, MAX, MIN, AVG, COUNT) or with the name extend, you must qualify the routine name with an owner name.