The ALTER FUNCTION statement is identical in syntax to the CREATE FUNCTION statement except for the first word.
With ALTER FUNCTION, existing permissions on the function remain unmodified. Conversely, if you execute DROP FUNCTION followed
by CREATE FUNCTION, execute permissions are reassigned.
Use SET HIDDEN to obfuscate the definition of the associated function and cause it to become unreadable. The function
can be unloaded and reloaded into other databases.
If SET HIDDEN is used, debugging using the debugger does not show the function definition, nor is it available through procedure
This setting is irreversible. It is strongly advised that you retain the original function definition outside of the database.
Use the RECOMPILE syntax to recompile a user-defined SQL function. When you recompile a function, the definition stored
in the catalog is re-parsed and the syntax is verified. The preserved source for a function is not changed by recompiling.
When you recompile a function, the definitions obfuscated by the SET HIDDEN clause remain obfuscated and unreadable.
Vendor extension. ALTER FUNCTION is optional SQL language feature F381 of the SQL/2008 standard. However, in the SQL
standard, ALTER FUNCTION cannot be used to re-define a PSM function definition. SQL/2008 does not include support for SET
HIDDEN or RECOMPILE.
In this example, MyFunction is created and altered. The SET HIDDEN clause obfuscates the function definition and makes it
CREATE FUNCTION MyFunction(
lastname CHAR(30) )
DECLARE name CHAR(61);
SET name = firstname || ' ' || lastname;
ALTER FUNCTION MyFunction SET HIDDEN;