PARAMETRIZED CURSOR
Parametrized Cursor is not supported by Snowflake Scripting
Description
Oracle supports parameters for cursors that are declared. However, Snowflake Scripting does not support this feature, so the declaration and the usage of the cursor are not possible.
Example Code
Input Code Oracle:
CREATE OR REPLACE PROCEDURE parametrized_cursor_sample AS
CURSOR cursor1(param1 number) IS SELECT region_name FROM hr.regions where region_id = param1 ORDER BY region_name;
var1 integer;
BEGIN
OPEN cursor1(123);
FETCH cursor1 INTO var1;
CLOSE cursor1;
FOR r1 IN cursor1(456) LOOP
NULL;
END LOOP;
END;Output Code:
Recommendations
Try using bindings for the query in the cursor and open the cursor with the
USINGclause. Keep in mind that a parameter that is used multiple times on a single cursor may require passing the variable multiple times in theUSINGclause.
Manually change the cursor to use bindings.
If you need more support, you can email us at [email protected]
Related EWIs
SSC-PRF-0004: This statement has usages of cursor for loop.
Last updated