I have an sql statement, which should contain variable value in it. but because the sql statement is coming from database retrieve, I cant do this.
my code is:
var MySQLCommand_101 = `
SELECT PARAM_VALUE FROM MNG.GENERAL.MNG_ELT_PARAMETERS
`;
var stmt = snowflake.createStatement( {sqlText:MySQLCommand_101} );
var resultSet = stmt.execute();
resultSet.next();
var VALIDATION_RESULT = resultSet.getColumnValue(1);
now,
VALIDATION_RESULT = 'CASE WHEN DIV0(ERROR_ROWS, TOTAL_ROWS) * 100 > ${ERROR_PERCENTAGE_THRESHOLD} THEN 1 ELSE 0 END AS VALIDATION_RESULT'
in my code, I assigned ERROR_PERCENTAGE_THRESHOLD = 30. but because the VALIDATION_RESULT is coming in the execution dinamically, and did not compiled- when I return VALIDATION_RESULT I get the string itself,
CASE WHEN DIV0(ERROR_ROWS, TOTAL_ROWS) * 100 > ${ERROR_PERCENTAGE_THRESHOLD} THEN 1 ELSE 0 END AS VALIDATION_RESULT
while I'm expecting to get
CASE WHEN DIV0(ERROR_ROWS, TOTAL_ROWS) * 100 > 30 THEN 1 ELSE 0 END AS VALIDATION_RESULT
thanks for helping,