An array with the values or the variables to bind into the SQL statement.
NoCatch (optional)
Boolean to know if an error should not be catched.
catchFunction (optional)
A function to execute in case an error occurs during the execution of the exec function.
opts (optional)
A JSON object ({ temp : true }) to know if the query ID should be returned.
FixBind And FormatDate Functions
The Exec helper uses a function defined in the helpers called FixBind. This function uses the FormatDate function when it encounters that one of the binding variables is a date type, this is done to manage properly the date types in Snowflake.
Both functions are defined as below.
REPLACEPROCEDURE ProcedureSample ()BEGINcasevaluewhen0thenselect*from table1elseupdate table1 setname="SpecificValue"where id =value;endcaseEND;
Snowflake output
CREATEORREPLACEPROCEDUREPUBLIC.ProcedureSample ()RETURNSSTRINGLANGUAGEJAVASCRIPTEXECUTEASCALLERAS$$// REGION SnowConvert Helpers Codeswitch(value) {case0:EXEC(`SELECT * FROM PUBLIC.table1`,[]);break;default:EXEC(`UPDATE PUBLIC.table1 set name = "SpecificValue" where id = value`,[]);break; }$$;