Error :"Bind variable ? not set"... while binding the parameter multiple times in Snowflake Stored Procedures , the following is my Stored Procedure
Error :"Bind variable ? not set"... while binding the parameter multiple times in Snowflake Stored Procedures , the following is my Stored Procedure
create or replace procedure check(vendor varchar)
returns varchar
language javascript
execute as caller
as
$$
var command7=`update test set id_null=( select count(*) from table where lower(trim(source))=? and id is null), 1_null=(select count(*) from table where lower(trim(source))=? and 1 is null), 2_null=(select count(*) from table where lower(trim(source))=? and 2 is null) where vendor=concat('${VENDOR}','ABC')`;
var stmt7=snowflake.createStatement({sqlText: command7, binds: [VENDOR], binds: [VENDOR], binds: [VENDOR]});
var rs7=stmt7.execute();
$$
返回错误:“绑定变量?未设置”
代替这一行:
var stmt7=snowflake.createStatement({sqlText: command7, binds: [VENDOR], binds: [VENDOR], binds: [VENDOR]});
试试这个:
var stmt7=snowflake.createStatement({sqlText: command7, binds: [VENDOR, VENDOR, VENDOR]});
create or replace procedure check(vendor varchar)
returns varchar
language javascript
execute as caller
as
$$
var command7=`update test set id_null=( select count(*) from table where lower(trim(source))=? and id is null), 1_null=(select count(*) from table where lower(trim(source))=? and 1 is null), 2_null=(select count(*) from table where lower(trim(source))=? and 2 is null) where vendor=concat('${VENDOR}','ABC')`;
var stmt7=snowflake.createStatement({sqlText: command7, binds: [VENDOR], binds: [VENDOR], binds: [VENDOR]});
var rs7=stmt7.execute();
$$
返回错误:“绑定变量?未设置”
代替这一行:
var stmt7=snowflake.createStatement({sqlText: command7, binds: [VENDOR], binds: [VENDOR], binds: [VENDOR]});
试试这个:
var stmt7=snowflake.createStatement({sqlText: command7, binds: [VENDOR, VENDOR, VENDOR]});