Specify a routine name

You specify a name for the SPL routine immediately following the CREATE PROCEDURE or CREATE FUNCTION statement and before the parameter list, as the figure shows.
Figure 1: Specify a name for the SPL routine.
CREATE PROCEDURE add_price (arg INT ) 
HCL OneDB™ allows you to create more than one SPL routine with the same name but with different parameters. This feature is known as routine overloading. For example, you might create each of the following SPL routines in your database:
CREATE PROCEDURE multiply (a INT, b FLOAT)
CREATE PROCEDURE multiply (a INT, b SMALLINT)
CREATE PROCEDURE multiply (a REAL, b REAL)

If you call a routine with the name multiply(), the database server evaluates the name of the routine and its arguments to determine which routine to execute.

Routine resolution is the process in which the database server searches for a routine signature that it can use, given the name of the routine and a list of arguments. Every routine has a signature that uniquely identifies the routine based on the following information:
  • The type of routine (procedure or function)
  • The routine name
  • The number of parameters
  • The data types of the parameters
  • The order of the parameters
The routine signature is used in a CREATE, DROP, or EXECUTE statement if you enter the full parameter list of the routine. For example, each statement in the following figure uses a routine signature.
Figure 2: Routine signatures.
CREATE FUNCTION multiply(a INT, b INT);

DROP PROCEDURE end_of_list(n SET, row_id INT);

EXECUTE FUNCTION compare_point(m point, n point);