16.2 Creating (registering) a stored procedure or stored function

Organization of this section
(1) Creating a stored procedure
(2) Creating a stored function

(1) Creating a stored procedure

CREATE PROCEDURE is used to create a stored procedure. For details on how to use CREATE PROCEDURE to create a procedure, see the manual HiRDB Version 8 UAP Development Guide.

(2) Creating a stored function

CREATE FUNCTION is used to create a stored function. For details on how to use CREATE FUNCTION to create a function, see the manual HiRDB Version 8 UAP Development Guide.

(a) When a stored function is created, an existing stored function may be invalidated

When a stored function is created, an existing stored function may become invalid. An existing stored function that satisfies the following condition becomes invalid:

In this case, use ALTER ROUTINE to re-create the invalidated stored function.

(b) When a stored function is created, an existing stored procedure may be invalidated

When a stored function is created, an existing stored procedure may become invalid. An existing stored procedure that satisfies the following condition becomes invalid:

In this case, use the ALTER PROCEDURE statement or ALTER ROUTINE to re-create the invalidated stored procedure.

(c) When a stored function is created, an existing trigger may be invalidated

When a stored function is created, an existing trigger may become invalid. An existing trigger that satisfies the following condition becomes invalid:

In this case, use the ALTER TRIGGER statement or ALTER ROUTINE to re-create the invalidated trigger.

(d) A newly created stored function may be invalidated

A stored function created using the following procedure may become invalid:

Procedure
  1. Install a plug-in.
  2. Create a stored function for calling the plug-in function installed in step 1.*
  3. Install a different plug-in from the one installed in step 1.
* If the plug-ins installed in steps 1 and 3 have the same function name and the same number of parameters, the stored function created in step 2 is invalidated when step 3 is executed. In such a case, ALTER ROUTINE can used to re-create the invalidated stored function.