Function of REPLACE METHOD - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
imq1591724555718.ditamap
dita:ditavalPath
imq1591724555718.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

When you replace a method, Vantage resets its execution mode to PROTECTED by default. You must then reset its execution mode to NOT PROTECTED using an ALTER METHOD request (see ALTER METHOD).

REPLACE METHOD replaces the code of a method. Its intended use is to correct software errors in a method.

Recall that creation or replacement of a method requires that there be declarations within two DDL statements on behalf of the method being created or replaced.
  • A method signature declaration is required within the CREATE TYPE request defining the UDT with which the method is associated.
  • A CREATE METHOD request is required to complete the body definition for the method being created.

With respect to the execution mode of the created or replaced method, the execution mode of the method is changed back to PROTECTED after Vantage replaces its code.

The syntax for REPLACE METHOD does not follow the typical form for Teradata SQL REPLACE statements. The standard REPLACE statement creates the specified object or definition if it does not already exist, acting exactly like its corresponding CREATE statement. REPLACE METHOD diverges from this standard because the CREATE METHOD statement is not a standalone operation.

The creation of a method requires that the method signature must first be specified within a CREATE TYPE or ALTER TYPE request, followed by it declaration by means of a CREATE METHOD or REPLACE METHOD request.

Although REPLACE METHOD does not follow the typical behavior of REPLACE statements with respect to operating as a standalone operation, it does follow the spirit of other replace operations in that it enables the source code for the method to be replaced, recompiled, and redistributed, thus replacing the behavior of the method.