Examples of UDXs that use any-size declarations

The following is an example for a UDSF that uses any-size declarations for both its input argument and return value:
CREATE FUNCTION character(char CHAR(ANY))
RETURNS CHAR(ANY) DETERMINISTIC
LANGUAGE CPP PARAMETER STYLE NPSGENERIC
EXTERNAL 'char';
In this example, the character() function takes an input character data type of any size and returns a character data type of a size that is calculated by the UDSF.
The following is an example for a UDAF that uses an any-size declaration for its input argument:
CREATE OR REPLACE AGGREGATE char20 (CHAR(ANY))
RETURNS CHAR(20) STATE (CHAR(20)) DETERMINISTIC
LANGUAGE CPP PARAMETER STYLE NPSGENERIC
EXTERNAL 'Char20';