informix
Informix Guide to SQL: Syntax
SQL Statements

DROP ROUTINE

Use the DROP ROUTINE statement to remove a user-defined routine (UDR) from the database.

Syntax

Element Purpose Restrictions Syntax
parameter_type Data type of the parameter The data type (or list of data types) must be the same types (and specified in the same order) as those specified when the UDR was created. Identifier, p. 4-205
routine Name of the UDR to drop The UDR must exist (that is, be registered) in the database. If the name does not uniquely identify a UDR, you must enter one or more appropriate values for parameter_type. Database Object Name, p. 4-50

Usage

Dropping a UDR removes the text and executable versions of the UDR from the database.

This statement is useful when you do not know whether a UDR is a user-defined function or a user-defined procedure. When you use this statement, the database server drops the appropriate user-defined function or user-defined procedure.

To use the DROP ROUTINE statement, you must be the owner of the UDR or have the DBA privilege.

Restrictions

When you use this statement, the type of UDR cannot be ambiguous. The UDR that you specify must refer to either a user-defined function or a user-defined procedure. If either of the following conditions exist, the database server returns an error:

Examples

If you use parameter data types to identify a UDR, they follow the UDR name, as in the following example:

If you use the specific name for the UDR, you must use the keyword SPECIFIC, as in the following example:

Dropping SPL Routines

Because you cannot change the text of an SPL routine, you must drop it and then re-create it. Make sure that you have a copy of the SPL function text somewhere outside the database, in case you want to re-create it after it is dropped.

You cannot drop an SPL routine from within the same SPL routine.

Related Information

Related statements: CREATE FUNCTION, CREATE PROCEDURE, DROP FUNCTION, DROP PROCEDURE, EXECUTE FUNCTION, and EXECUTE PROCEDURE


Informix Guide to SQL: Syntax, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved