Share via


DROP PROCEDURE

Important

This feature is in Public Preview.

Applies to: check marked yes Databricks Runtime 17.0 and above

Drops a user defined procedure.

To drop a function you must have the MANAGE privilege on the procedure, be its owner, or the owner of the schema, catalog, or metastore the procedure resides in.

Syntax

DROP PROCEDURE [ IF EXISTS ] procedure_name

Parameters

  • procedure_name

    The name of an existing procedure. The procedure name may be optionally qualified with a schema name.

  • IF EXISTS

    If specified, no exception is thrown when the procedure does not exist.

Examples

-- Create a procedure `hello`
> CREATE PROCEDURE hello() SQL SECURITY INVOKER LANGUAGE SQL
  AS BEGIN
    SELECT 'hello!';
  END;

-- Drop the procedure
> DROP PROCEDURE hello;

-- Try to drop a procedure which is not present
> DROP PROCEDURE hello;
Error: ROUTINE_NOT_FOUND

-- Drop a procedure only if it exists
> DROP PROCEDURE IF EXISTS hello;