How to use strict property in Snowflake UDFs
How to use strict property in Snowflake UDFs
User Defined Functions in Snowflake Video
You can watch the complete hands on video tutorial
Step-5: SQL Construct
use role sysadmin;
use database ttips;
use schema udfs;
-- creating a javascript function with not null specification
create or replace function null_handling_sql_udf(code string)
returns string
language sql
returns null on null input
comment = 'This udf will check the return null on null input behaviour'
as
$$
select 'I am running all the time'
$$;
create or replace function null_handling_js_udf(code string)
returns string
language javascript
returns null on null input
comment = 'This udf will check the return null on null input behaviour'
as
$$
return 'I run only when input is NOT null'
$$;
-- list function
show functions like 'NULL_H%';
-- desc the function
desc function NULL_HANDLING_SQL_UDF(string);
desc function NULL_HANDLING_JS_UDF(string);
select NULL_HANDLING_SQL_UDF(null),
NULL_HANDLING_SQL_UDF('SQL-Test'),
NULL_HANDLING_JS_UDF(null),
NULL_HANDLING_JS_UDF('JS-Test')
;
All SQL Scripts - Part 01 to Part 09
All SQL Scripts - Part 01 to Part 09
- Part-01 User Defined Function in Snowflake SQLs
- Part-02 JavaScript & SQL User Defined Function in Snowflake SQLs
- Part-03 Strict Property User Defined Function in Snowflake SQLs
- Part-04 Not Null Return User Defined Function in Snowflake SQLs
- Part-05 Secure User Defined Function in Snowflake SQLs
- Part-06 Inbuilt Vs. User Defined Function in Snowflake SQLs
- Part-07 Table User Defined Function in Snowflake SQLs
- Part-08 Method Overloading SQL Script
- Part-09 Java User Defined Function SQL & Java Code