Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
Numeric value '"+i+"' is not recognized At Statement.execute in snowflake stored procedure while executing below code?

Below is the stored procedure which uses for loop using java script

 create or replace procedure test()
    returns varchar
    language javascript
    execute as caller
    as
    $$
    for (var i = 1; i<= 10; i++)
    {
        var command8=` update table a set a.c1='some' from table b where a.source='gg' and b.c2=a.c2 and b.c3=a.c3 and (datediff(year,date(a.etl_create),current_date())= '"+i+"')`
        var stmt8=snowflake.createStatement({sqlText: command8});
        var rs8=stmt8.execute();
    }
about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Using bidning variables:

for (var i = 1; i<= 10; i++)
{
    var command8=` update table a set a.c1='some' 
                   from table b 
                   where a.source='gg' and b.c2=a.c2 and b.c3=a.c3 
                    and (datediff(year,date(a.etl_create),current_date())= :1)`
    var stmt8=snowflake.createStatement({sqlText: command8, binds:[i]});
    var rs8=stmt8.execute();
}
about 4 years ago · Santiago Trujillo Report

0

To substitute a variable into a template literal, use ${variable}.

var command8=` update table a set a.c1='some' from table b where a.source='gg' and b.c2=a.c2 and b.c3=a.c3 and (datediff(year,date(a.etl_create),current_date())= '${i}')`
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!