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

225
Views
Snowflake stored procedure parameter problem

I want to log an error that happens in stored procedure:

catch (ERROR)  {
      snowflake.execute({sqlText: sql_update_log_command, binds: [RUN_ID, PROCESS_ID,'error', 0, ERROR.message] });
        return "Failed: " + ERROR.message;
    }

sql_update_log_command executes procedure "update_process_log" and binds those 5 arguments. But, when error happens columns that should contain error message stays empty. Error was something like this:

"Failed: Numeric value '$METADATA$FILE_ROW_NUMBER' is not recognized File 'data/stage/20220104/user_activity/20220104-172435475.csv.gz', line 2, character 1 Row 1, column $METADATA$FILE_ROW_NUMBER If you would like to continue loading when an error is encountered, use other values such as 'SKIP_FILE' or 'CONTINUE' for the ON_ERROR option. For more information on loading options, please run 'info loading_data' in a SQL client."

Procedure "update_process_log" signature:

create or replace procedure metadata.update_process_log(
    RUN_ID FLOAT, 
    PROCESS_ID FLOAT, 
    PROCESS_STATUS VARCHAR,
    NUM_OF_RECORDS FLOAT,
    ERROR_MSG VARCHAR)
returns string
  language javascript

Does it look like dollar sign $ is making a problem? How can this be handled?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I found a solution in this question - Snowflake working with stored procedure on error handling

Basically you have to escape single quotes before logging rows:

err.message.replace( /'/g , "''" )
about 4 years ago · Juan Pablo Isaza 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!