In this Topic:
All the CREATE FUNCTION examples in this topic illustrate the syntax for creating UDFs using SnowSQL or the Worksheet (in the Snowflake web interface). If these examples are
sfsql, you must include a forward slash character (
/) on a new line after the CREATE FUNCTION command to terminate the command.
In SnowSQL and the Worksheet, a forward slash is not required and will return an error if specified.
Uint8Array object, it is converted into a Snowflake binary value.
- All precision beyond milliseconds is lost.
Dategenerated from SQL TIMESTAMP_NTZ no longer act as “wallclock” time; they are influenced by daylight saving. This is similar to behavior when converting TIMESTAMP_NTZ to TIMESTAMP_LTZ.
Dategenerated from SQL TIMESTAMP_TZ lose time zone information, but represent the same moment in time as the input (similar to when converting TIMESTAMP_TZ to TIMESTAMP_LTZ).
Daterepresenting midnight of the current day in the local time zone.
Dateobjects are converted to the function’s result data type, adhering to the same conversion semantics as casts from SQL TIMESTAMP_LTZ(3) to the return data type.
Dateobjects nested inside VARIANT objects are always of type TIMESTAMP_LTZ(3).
Variant, Objects, and Arrays¶
$, while subsequent characters may be alphanumeric,
The following three examples illustrate functions that use arguments referenced by name:
Null and Undefined Values¶
undefined value in addition to null.
Excessive stack depth due to recursion will result in an error.
You should not rely on global data being available between function calls from one row to the next. The global state may be erased between UDF calls to distinct rows. It is safe to use global state within a UDF.
eval() function is disabled.
Returned Variant Size and Depth¶
Returned variant objects are subject to size and nesting-depth limitations. Should any object be too large (several megabytes; subject to change) or too deep (currently allow a nesting depth of 1000 in objects and arrays; subject to change) you will receive an error.