SQL UDF Limitations

This topic describes the limitations for handlers written in SQL.

Argument and Return Type Constraints Are Sometimes Ignored

Certain type characteristics declared for an argument or return value will be ignored when the UDF is called. In these cases, the received value may be used as received whether or not it conforms to constraints specified in the declaration.

The following are ignored for UDFs whose logic is written in SQL:

  • Precision and scale for arguments and return values of type NUMBER

  • Length for arguments and return values of type VARCHAR

Example

Code in the following example declares that the arg1 argument and the return value must be a VARCHAR no more than one character long. However, calling this function with an arg1 whose value is longer than one character will succeed as if the constraint were not specified.

CREATE OR REPLACE FUNCTION tf (arg1 VARCHAR(1))
RETURNS VARCHAR(1)
LANGUAGE SQL AS 'SHA2(a)';
Copy