I wanted to try this SQL to use bind variables as input (not in a stored procedure or anonymous block), but it's throwing an error.
LET VARIABLE VARCHAR := 'RPT';
SELECT * FROM TABLE_NAME WHERE TYPE= :VARCHAR
I see this message:
Syntax error: unexpected 'LET'. (line 26)
How can I resolve this?
Snowflake:
SET rpt_var = 'RPT';
SELECT * FROM TABLE_NAME WHERE TYPE = $rpt_var;
Snowflake does not support bind variables directly inside plain SQL statements without using session variables (SET) or scripting. Snowflake currently has no syntax for direct bind variables in standalone SQL queries without SET or scripting.