O'Reilly logo

SQL in a Nutshell by Kevin Kline

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

DROP FUNCTION

Synopsis

This command removes a user-defined function from the current database.

Vendor

Command

SQL Server

Supported, with variations

MySQL

Supported, with variations

Oracle

Supported, with variations

PostgreSQL

Supported, with variations

SQL99 Syntax and Description

DROP FUNCTION function_name {RESTRICT | CASCADE}

This command permanently destroys a function. The RESTRICT clause ensures that the command fails if other database objects, such as a view, depend upon the function. On the other hand, the CASCADE option drops the function, any grants based on the function, and any dependent database objects!

Microsoft SQL Server Syntax and Variations

DROP FUNCTION [owner_name.]function_name [,...n]

As with other SQL Server DROP commands, more than one database object of the same type may be dropped by placing a comma between the names of each database object.

MySQL Syntax and Variations

This command does not actually delete the file containing the function. Instead, it deletes the function reference from the system table, which can be added back by using the CREATE FUNCTION statement.

Oracle Syntax and Variations

DROP FUNCTION [owner_name.]function_name

As with other Oracle DROP commands, the name of the function owner may be specified. Otherwise, Oracle assumes the current-user context, and only functions owned by the current user to be dropped. Alternately, those users with DROP ANY FUNCTION system privilege are allowed to drop any function anywhere.

PostgreSQL Syntax ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required