DROP PROCEDURE

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 17.0 and above

Drops a user defined procedure.

Permissions

To drop a procedure, you must own it or have MANAGE on it, or own or have MANAGE on its parent schema or catalog. The usage privileges you also need depend on the object level at which you hold ownership or MANAGE. See Usage privilege requirements for MANAGE.

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;