When you replace a method, Teradata Database 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.
- 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 Teradata Database replaces its code.
The syntax for REPLACE METHOD does not follow the typical form for Teradata Database REPLACE statements. The standard Teradata Database 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 Teradata Database 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.