The DROP PROCEDURE command

Use the DROP PROCEDURE command to remove an existing stored procedure from a database.

Synopsis

DROP PROCEDURE <name> (<arguments>)

Inputs

The DROP PROCEDURE command takes the following inputs:
Table 1. DROP PROCEDURE inputs
Input Description
name The name of the stored procedure that you want to drop. The procedure must be defined in the database to which you are connected.

For systems that support multiple schemas, you can specify a name in the format schema.procedure to drop a procedure in a different schema of the current database. You cannot drop a procedure in a different database.

arguments A list of input arguments to uniquely identify the stored procedure.

Outputs

The DROP PROCEDURE command has the following outputs:
Table 2. DROP PROCEDURE Outputs
Output Description
DROP PROCEDURE The message that the system returns if the command is successful.
ERROR: DROP PROCEDURE: permission denied The user does not have Drop permission.
ERROR: RemoveFunction: function 'NAME(ARGS)' does not exist The message that indicates that the specified procedure signature does not exist in the database.
ERROR: Name: No such stored procedure The message that the system returns if the specified stored procedure does not exist in the current database.
ERROR: RemoveFunction: existing UDX NAME(ARGS) differs in size of string/numeric arguments This error indicates that a stored procedure exists with the name but has different sizes specified for string or numeric arguments.

To drop the stored procedure, make sure that you specify the exact argument type list with correct sizes.

Description

You cannot drop a stored procedure that is currently in use in an active query. After the transaction completes for an active query, the Netezza Performance Server system processes the DROP PROCEDURE command. The stored procedure must be defined in the current database.

The DROP PROCEDURE command has the following characteristics:
Privileges required
To drop a stored procedure, you must meet one of the following criteria:
  • You must have the Drop privilege on the PROCEDURE object.
  • You must have the Drop privilege on the specific stored procedure.
  • You must own the stored procedure.
  • You must be the database admin user or own the current database or the current schema on systems that supports multiple schemas.
Common tasks
Use the DROP PROCEDURE command to drop an existing stored procedure from a database.

Usage

To drop a sample stored procedure named mycalc(), enter:
   system(admin)=> DROP PROCEDURE mycalc();