Creating a Table user-defined function using JavaScript
Snowflake provides capabilities for creating UDFs that can be used to extend the system and perform operations not available out of the box in Snowflake. Snowflake allows two languages for the creation of UDFs, SQL-based UDFs and JavaScript-based UDFs. Either of the UDF types can return scalar or table results.
In this recipe, we will create JavaScript-based Table UDFs and demonstrate how to call the UDFs for various scenarios.
Getting ready
You will need to be connected to your Snowflake instance via the Web UI or the SnowSQL client to execute this recipe.
How to do it
We will be creating a series of UDFs to demonstrate the Table SQL UDF capabilities provided by Snowflake. We will start by exploring some of the existing Table UDFs provided by Snowflake and reviewing their output. The basic syntax for creating a JavaScript table UDF is as follows:
CREATE FUNCTION <name> ( [ <arg_name> <arg_data_type...