ALTER FUNCTION statement

Description

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.

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

Permissions

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

See also

ALTER PROCEDURE statement

CREATE FUNCTION statement

DROP statement

“Hiding the contents of procedures, functions, and views” in Chapter 1, “Using Procedures and Batches” in the System Administration Guide: Volume 2