CREATE FUNCTION#

Synopsis#

CREATE [OR REPLACE] FUNCTION
  routine_definition

Description#

Create or replace a Catalog routines. The routine_definition is composed of the usage of FUNCTION and nested statements.

The optional OR REPLACE clause causes the routine to be replaced if it already exists rather than raising an error.

Examples#

The following example creates the meaning_of_life routine:

CREATE FUNCTION meaning_of_life()
  RETURNS bigint
  BEGIN
    RETURN 42;
  END;

Further examples of varying complexity that cover usage of the FUNCTION statement in combination with other statements are available in the SQL routines examples documentation.

See also#