I am trying to add single quote around the string and assign it to variable in a Snowflake Stored Procedure. But the value is returning as DEFAULT_STR as is.
var DEFAULT_STR = 'UNKNOWN' var VAL_LIST = 'EMP_ID' VAL_LIST = VAL_LIST +" "+ "'`${DEFAULT_STR}`'" + ','+ '"SYSTEM"';
Error Message:
SQL compilation error: error line 1 at position 183 invalid identifier '"
${DEFAULT_STR}"' At Snowflake.execute
Please advise how I can achieve below expected output-
Expected output:
'EMP_ID UNKNOWN, SYSTEM"
Advertisement
Answer
This one should give you the output you want:
VAL_LIST = "'" + VAL_LIST +" "+ DEFAULT_STR + "," + "SYSTEM'";
The output of VAL_LIST is:
'EMP_ID UNKNOWN,SYSTEM'