Troubleshooting JavaScript UDFs

This topic provides information about troubleshooting JavaScript UDFs.

In this Topic:


  • JavaScript is case sensitive, but SQL forces names to upper case. This can affect UDF input parameter names, for example. JavaScript code should reference input parameter names by using all upper case.

  • If using a JavaScript UDF in a masking policy, ensure the data type of the column, UDF, and masking policy match.


Error Message: Variable is not defined


In some cases, this error message might be caused by an ampersand (&) inside a CREATE FUNCTION command because the ampersand is the variable substitution character. For example:

create function mask_bits(...)
    var masked = (x & y);

The error will occur at the time that the function is created, not at the time that the function is called.


If you do not intend to use variable substitution, you can explicitly disable it. For example, in SnowSQL, you can disable variable substitution by executing the following command:

!set variable_substitution=false;

For more information about variable substitution, see Using Variables.