You must define the SPL variable that holds the name of
the dynamically executed SPL routine as CHAR, VARCHAR, NCHAR, or NVARCHAR
type. You must also give the SPL variable a valid and non-NULL name.
The
SPL routine that the dynamic routine-name specification identifies
must exist before it can be executed. If you assign the SPL variable
the name of a valid SPL routine, the EXECUTE PROCEDURE or EXECUTE
FUNCTION statement executes the routine whose name is contained in
the variable, even if a built-in function of the same name exists.
In
an EXECUTE PROCEDURE or EXECUTE FUNCTION statement, you cannot use
two SPL variables to create a variable name in the form owner.routine_name.
However, you can use an SPL variable that contains a fully qualified
routine name, for example, bill.proc1. The following figure
shows both cases.Figure 1. SPL variable that contains a fully qualified routine name.
EXECUTE PROCEDURE owner_variable.proc_variable;
-- this is not allowed
LET proc1 = bill.proc1;
EXECUTE PROCEDURE proc1; -- this is allowed