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.
Please note parenthesis are required for parameters in the USING Clause in Snowflake Scripting.
OUT -> Oracle_04.sql
CREATE OR REPLACETABLEimmediate_inserted_table (COL1 INTEGER)COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
;CREATEORREPLACEPROCEDURE inserting_procedure_using (param1 INTEGER)RETURNSVARCHARLANGUAGESQLCOMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
EXECUTEASCALLERAS$$BEGIN !!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!EXECUTEIMMEDIATE'INSERT INTO immediate_inserted_tableVALUES (?)'USING ( param1);END;$$;CALL inserting_procedure_using(1);SELECT*FROM immediate_inserted_table;
COL1|
----+
1|
Known Issues
1. Immediate Execution results cannot be stored in variables.
SnowScripting does not support INTO nor BULK COLLECT INTO clauses. For this reason, results will need to be passed through other means.
2. Numeric Placeholders
Numeric Names for placeholders are currently not being recognized by SnowConvert, but there is a work item to fix this issue.
3. Argument Expressions are not supported by Snowflake Scripting
In Oracle it is possible to use Expressions as Arguments for the Using Clause; however, this is not supported by Snowflake Scripting, and they are commented out.
4. Dynamic SQL Execution queries may be marked incorrectly as non-runnable.
In some scenarios there an execute statement may be commented regardless of being safe or non-safe to run so please take this into account:
Please note parenthesis are required for parameters in the USING Clause in Snowflake Scripting.
OUT -> Oracle_05.sql
CREATEORREPLACEPROCEDURE inserting_procedure_variable_execute_concatenation_parameter (param1 INTEGER)RETURNSVARCHARLANGUAGESQLEXECUTEASCALLERAS$$DECLARE query VARCHAR(500) :='INSERT INTO immediate_inserted_table VALUES (';BEGIN !!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!! !!!RESOLVE EWI!!! /*** SSC-EWI-0027 - THE FOLLOWING STATEMENT USES A VARIABLE/LITERAL WITH AN INVALID QUERY AND IT WILL NOT BE EXECUTED ***/!!!
EXECUTEIMMEDIATE NVL(:query :: STRING, '') || NVL(:param1 :: STRING, '') ||')';END;$$;