DROP FUNCTION

Synopsis

DROP FUNCTION function_name (arg_name arg_type [, ...]);

Description

Drops an existing user-defined Function. The Function's name and its list of arguments (as specified when the Function was created using the CREATE FUNCTION statement) should be provided for identifying the Function. This statement can only be executed by the Function owner.

DROP FUNCTION cannot be undone. Use it with care!

Functions will only be visible if the current Role has USAGE privileges on them.

Arguments

function_name

The name of the Function to drop. For case-sensitive names, the name must be wrapped in double quotes, otherwise, the lowercased name will be used.

(arg_name arg_type [,…​])

An ordered list of Function argument names and types.

Example

Drop a Function

Assume a user-defined Function, named touppercase, is created using the CREATE FUNCTION statement and is now available:

db1.public/my_store# CREATE FUNCTION toUpperCase (s VARCHAR) RETURNS VARCHAR LANGUAGE JAVA WITH ('source.name' = 'mysrc', 'class.name' = 'util.UpperCase');
+------------+-------------+------------+------------------------------------------+
|  Type      |  Name       |  Command   |  Summary                                 |
+============+=============+============+==========================================+
| function   | touppercase | CREATE     | function touppercase was successfully    |
|            |             |            | created                                  |
+------------+-------------+------------+------------------------------------------+

This Function can be dropped with the below statement:

db1.public/my_store# SHOW FUNCTIONS;
+--------------------------------+-------+--------------+----------------+--------------------+------------+-------------+-------------------------------+-------------------------------+
|  Signature                     |  Type |  Source Name |  Class Name    |  Egress Allow URIs |  Owner     |  Properties |  Created At                   |  Updated At                   |
+================================+=======+==============+================+====================+============+=============+===============================+===============================+
| touppercase(s VARCHAR) VARCHAR | udf   | functions    | util.UpperCase |                    | sysadmin   | {}          | 2024-07-02 22:25:20 +0000 UTC | 2024-07-02 22:25:20 +0000 UTC |
+--------------------------------+-------+--------------+----------------+--------------------+------------+-------------+-------------------------------+-------------------------------+
db1.public/my_store# DROP FUNCTION toUpperCase (s VARCHAR);
+------------+-------------+------------+---------------------------------------+
|  Type      |  Name       |  Command   |  Summary                              |
+============+=============+============+=======================================+
| function   | touppercase | DROP       | function touppercase has been deleted |
+------------+-------------+------------+---------------------------------------+

Last updated