Generic-size arguments

Generic-size (or any-size) arguments offer more flexibility for strings and numerics. You can declare character strings or numerics by using the ANY keyword in the signature (or in the return value). For example:
MYDB.SCHEMA(MYUSER)=> CREATE FUNCTION CustomerName(varchar(ANY))
RETURNS int4 LANGUAGE CPP PARAMETER STYLE NPSGENERIC API VERSION 2
EXTERNAL CLASS NAME 'CCustomerName'
EXTERNAL HOST OBJECT '/home/nz/udx_files/customername.o_x86'
EXTERNAL SPU OBJECT '/home/nz/udx_files/customername.o_spu10';

The function accepts a character string of up to 64,000 characters (the maximum for a VARCHAR). Within the body of the function, the code must process the strings and numerics with the plan that you can receive a string of any valid length. That is, you can check and obtain their size, process them as needed, and return the value for the function.

Generic-size arguments help you to avoid specific limits for the input strings and numerics, or to use overly large or maximum size values that result in unnecessary resource allocation for the procedure. This format can also reduce the need to register and maintain similar procedures that take different input arguments or have different return values, and reduce possible casting of input values.

Note: UDFs support generic arguments and generic return values. UDAs, however, support only generic arguments. The return value and state arguments of a UDA must specify constant data sizes. UDTFs support shapers, which are similar to generic return values for scalar UDFs.