I am getting error with below code, please advise:
CREATE OR REPLACE FUNCTION fnParseString (STRINGTOP VARCHAR,DELIMITER1 VARCHAR)
RETURNS VARCHAR NOT NULL
language javascript
AS
$$
var sql_A = `SELECT CASE WHEN charindex(DELIMITER1,STRINGTOP) = 0 THEN 1 ELSE 0 END`;
var statement = snowflake.createStatement({sqlText:sql_A});
var rs = statement.execute();
return rs;
$$;
When I do > select function('this is test',' ');
Getting below error:
JavaScript execution error: Uncaught ReferenceError: snowflake is not defined in FNPARSESTRING at 'var statement = snowflake.createStatement({sqlText:sql_A});' position 16 stackstrace: FNPARSESTRING line: 3
thanks.
CodePudding user response: