I have created below stored Procedure but getting error while parsing VAL in where clause, i have tried double quotes " and backstick ` as well
create or replace TABLE T1 (
COL VARCHAR(16777216)
);
insert into t1 values ('test1');
insert into t1 values ('test2');
insert into t1 values ('test3');
create or replace procedure ifcopied(val varchar)
returns varchar
language javascript
execute as caller
as
$$
sql_command = "select * from t1 where col = " + VAL;
var stmt = snowflake.createStatement({sqlText:sql_command});
var res = stmt.execute();
res.next();
row_status = res.getColumnValue(1);
return row_status
$$;
call ifcopied('test3')
;
getting below error
Execution error in store procedure IFCOPIED: SQL compilation error: error line 1 at position 29 invalid identifier 'TEST3' At Statement.execute, line 4 position 50
Execution error in store procedure IFCOPIED: SQL compilation error: error line 1 at position 29 invalid identifier 'TEST3' At Statement.execute, line 4 position 50