Skip to main content

DROP FUNCTION Enterprise

Drops a user-defined function (UDF) in the Arctic catalog. Only the owner of a UDF may drop it (there is no separate DROP FUNCTION privilege).

Syntax
DROP FUNCTION [ IF EXISTS ] <function_name>
[ AT { REF[ERENCE] | BRANCH | TAG | COMMIT } <reference_name> ]
[ AS OF <timestamp> ]

To run DROP FUNCTION, users need the OWNERSHIP privilege on the UDF.

Parameters

[ IF EXISTS ] String   Optional

If specified, prevents an exception when the function does not exist.


<function_name> String

The name of an existing user-defined function.


AT { REF[ERENCE] | BRANCH | TAG | COMMIT } <reference_name> String   Optional

Specifies the reference at which the UDF exists. When this parameter is omitted, the current reference is used.

  • REF: Identifies a specific branch, tag, or commit.
  • BRANCH: Identifies a specific branch.
  • TAG: Identifies a specific tag.
  • COMMIT: Identifies a specific commit. Commit hashes must be enclosed in double quotes (for example, “ff2fe50fef5a030c4fc8e61b252bdc33c72e2b6f929d813833d998b8368302e2”.

AS OF <timestamp> String   Optional

Changes the commit reference point to the provided timestamp. Can only be applied to REF, BRANCH, and TAG. <timestamp> may be any SQL expression that resolves to a single timestamp type value, for example: CAST( DATE_SUB(CURRENT_DATE,1) AS TIMESTAMP ) or TIMESTAMP '2022-07-01 01:30:00.000'.

Examples

Create a function
CREATE FUNCTION hello() RETURNS VARCHAR RETURN 'Hello World!';
Remove an existing function
DROP FUNCTION hello;
Remove an existing function and prevent an exception if it does not exist
DROP FUNCTION IF EXISTS hello;