DROP FUNCTION Examples | Teradata Vantage - 17.00 - DROP FUNCTION Examples - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Release Date
September 2020
Content Type
Programming Reference
Publication ID
B035-1144-170K
Language
English (United States)

Example: Dropping an SQL Function

These examples drop an SQL function and a specific SQL function.

     DROP FUNCTION udf2 (INTEGER, INTEGER);
     DROP SPECIFIC FUNCTION specific_udf2;

Example: Dropping an External Function by Function Name or Specific Function Name

You can drop a function definition using either its function name or its specific function name. For example, consider the following function definition.

     CREATE FUNCTION Finger_Print_Match(VARBYTE(1000),
     VARBYTE(1000))
       RETURNS INTEGER
       SPECIFIC fpm1
       LANGUAGE C
       NO SQL
       PARAMETER STYLE TD_GENERAL
       EXTERNAL;

Either of the following DROP FUNCTION requests drops its definition, the first using its specific function name and the second using its function name.

     DROP SPECIFIC FUNCTION fpm1;
     DROP FUNCTION Finger_print_Match(VARBYTE, VARBYTE);

Example: Dropping an External Function and Unique Function Names

You can drop a function definition using either its function name or its specific function name. The example also shows that if the name cannot be resolved to a unique object using the DROP FUNCTION statement you specify, you cannot drop it.

Consider the following function definition.

     CREATE FUNCTION test_image(VARCHAR(5000), INTEGER) …
       SPECIFIC testi_opt1 …;
     CREATE FUNCTION test_image(VARCHAR(5000), FLOAT)…
       SPECIFIC testi_opt2 …;

The following DROP FUNCTION requests both drop this function.

     DROP SPECIFIC FUNCTION testi_opt1;
     DROP FUNCTION test_image(VARCHAR, INTEGER);

The following statement returns an error because there is not an instance of a function named test_image without parameters.

     DROP FUNCTION test_image();