Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime
Drops a temporary or permanent user-defined function (UDF).
To drop a function you must have the MANAGE privilege on the function, be its owner, or the owner of the schema, catalog, or metastore the function resides in.
Syntax
DROP [ TEMPORARY ] FUNCTION [ IF EXISTS ] function_name
Parameters
-
The name of an existing function. The function name may be optionally qualified with a schema name.
TEMPORARY
Used to delete a
TEMPORARYfunction.IF EXISTS
If specified, no exception is thrown when the function does not exist.
Examples
-- Create a permanent function `hello`
> CREATE FUNCTION hello() RETURNS STRING RETURN 'Hello World!';
-- Create a temporary function `hello`
> CREATE TEMPORARY FUNCTION hello() RETURNS STRING RETURN 'Good morning!';
-- List user functions
> SHOW USER FUNCTIONS;
default.hello
hello
-- Drop a permanent function
> DROP FUNCTION hello;
-- Try to drop a permanent function which is not present
> DROP FUNCTION hello;
Error: ROUTINE_NOT_FOUND
-- List the functions after dropping, it should list only temporary function
> SHOW USER FUNCTIONS;
hello
-- Drop a temporary function if exists
> DROP TEMPORARY FUNCTION IF EXISTS hello;