ALTER FUNCTION Statement

Modifies an existing function. Include the entire modified function in the ALTER FUNCTION statement.

Syntax

Syntax 1

ALTER FUNCTION [ owner.]function-name function-definition
function-definition CREATE FUNCTION syntax 

Syntax 2

ALTER FUNCTIONowner.]function-name
  SET HIDDEN 

Syntax 3

ALTER FUNCTIONowner.]function-name
  RECOMPILE 

Usage

Syntax 1—Identical in syntax to the CREATE FUNCTION statement except for the first word. Either version of the CREATE FUNCTION statement can be altered.

Existing permissions on the function are maintained and do not have to be reassigned. If a DROP FUNCTION and CREATE FUNCTION were carried out, execute permissions must be reassigned.

Syntax 2—Use SET HIDDEN to scramble the definition of the associated function and cause it to become unreadable. The function can be unloaded and reloaded into other databases.

Warning!  The SET HIDDEN setting is irreversible. If you need the original source again, you must maintain it outside the database.

If you use SET HIDDEN, debugging using the stored procedure debugger does not show the function definition, nor is it be available through procedure profiling.

See also System Administration Guide: Volume 2 > Using Procedures and Batches > Hiding the Contents of Procedures, Functions, and Views.

Syntax 3—Use RECOMPILE to recompile a user-defined 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 scrambled by the SET HIDDEN clause remain scrambled and unreadable.

Side effects:
  • Automatic commit

Standards

  • SQL—Vendor extension to ISO/ANSI SQL grammar.

Permissions

Must be the owner of the function or have DBA authority.

Related reference
ALTER PROCEDURE Statement
CREATE FUNCTION Statement
DROP Statement