DROP PROCEDURE (stored)
Drops a stored procedure.
Drops a stored procedure.
Syntax
DROP PROCEDURE [ IF EXISTS ] [[database.]schema.]procedure( [ parameter-type-list] ) [ CASCADE ];
Parameters
IF EXISTS
- Specifies not to report an error if the procedure to drop does not exist. Use this clause in SQL scripts to avoid errors on dropping non-existent objects before attempting to create them.
[
database
.]
schema
Database and schema. The default schema is
public
. If you specify a database, it must be the current database.procedure
- The name of the stored procedure, where
procedure
conforms to conventions described in Identifiers. parameter-type-list
- A comma-delimited list of the IN parameters' types.
- CASCADE
- Drops the trigger that references the stored procedure, if any.
Privileges
Non-superuser:
-
Owner or DROP privilege
-
USAGE privilege on schema
Examples
Given the following procedure:
=> CREATE PROCEDURE raiseXY(IN x INT, y VARCHAR) LANGUAGE PLvSQL AS $$
BEGIN
RAISE NOTICE 'x = %', x;
RAISE NOTICE 'y = %', y;
-- some processing statements
END;
$$;
CALL raiseXY(3, 'some string');
NOTICE 2005: x = 3
NOTICE 2005: y = some string
You can drop it with:
=> DROP PROCEDURE raiseXY(INT, VARCHAR);
DROP PROCEDURE
For more information on RAISE NOTICE, see Errors and diagnostics.