ALTER FUNCTION
Alters a stored function
DSQL
ALTER FUNCTION funcname
[ ( [ <in_params> ] ) ]
RETURNS <domain_or_non_array_type> [COLLATE collation]
[DETERMINISTIC]
{<psql_function> | <external-module-body>}
!! See syntax of CREATE FUNCTION
for further rules !!
The ALTER FUNCTION
statement allows the following changes to a stored function definition:
-
the set and characteristics of input and output type
-
local variables, named cursors, and subroutines
-
code in the body of the stored procedure
For external functions (UDR), you can change the entry point and engine name.For legacy external functions declared using DECLARE EXTERNAL FUNCTION
— also known as UDFs — it is not possible to convert to PSQL and vice versa.
After ALTER FUNCTION
executes, existing privileges remain intact and dependencies are not affected.
Altering a function without specifying the SQL SECURITY
clause will remove the SQL Security property if currently set for this function.This means the behaviour will revert to the database default.
Caution
|
Take care about changing the number and type of input parameters and the output type of a stored function.Existing application code and procedures, functions and triggers that call it could become invalid because the new description of the parameters is incompatible with the old calling format.For information on how to troubleshoot such a situation, see the article The |