EXECUTE IMMEDIATE
Translation reference to convert Oracle EXECUTE IMMEDIATE statement to Snowflake Scripting
Description
The
EXECUTE
IMMEDIATE
statement builds and runs a dynamic SQL statement in a single operation.Native dynamic SQL uses the
EXECUTE
IMMEDIATE
statement to process most dynamic SQL statements. (Oracle PL/SQL Language Reference EXECUTE IMMEDIATE Statement)
Snowflake Scripting has support for this statement, albeit with some functional differences. For more information on the Snowflake counterpart, please visit Snowflake's EXECUTE IMMEDIATE documentation.
Sample Source Patterns
The next samples will create a table, and attempt to drop the table using Execute Immediate.
Using a hard-coded string
Oracle
IN -> Oracle_01.sql
Snowflake Scripting
OUT -> Oracle_01.sql
Storing the string in a variable
Oracle
IN -> Oracle_02.sql
Snowflake Scripting
OUT -> Oracle_02.sql