HomeMogDBMogDB StackUqbar
v2.1

Documentation:v2.1

Supported Versions:

DROP FUNCTION

Function

DROP FUNCTION deletes a function.

Precautions

  • If a function involves operations on temporary tables, DROP FUNCTION cannot be used.
  • Only the function owner or a user granted with the DROP permission can run the DROP FUNCTION command. The system administrator has this permission by default.

Syntax

DropFunction ::= DROP FUNCTION [ IF EXISTS ] function_name
[ ( [ {[ argmode ] [ argname ] argtype} [, ...] ] ) [ CASCADE | RESTRICT ] ];

Parameter Description

  • IF EXISTS

    Reports a notice instead of an error if the specified function does not exist.

  • function_name

    Specifies the name of the function to be deleted.

    Value range: an existing function name

  • argmode

    Specifies the parameter mode of the function.

  • argname

    Specifies the parameter name of the function.

  • argtype

    Specifies the parameter type of the function.

  • CASCADE

    Automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects.

  • RESTRICT

    Refuse to drop the function if any objects depend on it. This is the default.

Examples

This command removes the square root function:

DROP FUNCTION sqrt(integer);

If the function name is unique in its schema, it can be referred to without an argument list:

DROP FUNCTION update_employee_salaries;

Note that this is different from

DROP FUNCTION update_employee_salaries();

which refers to a function with zero arguments, whereas the first variant can refer to a function with any number of arguments, including zero, as long as the name is unique.

ALTER FUNCTION and CREATE FUNCTION

Copyright © 2011-2024 www.enmotech.com All rights reserved.