Last updated
Last updated
This section covers the Translation Reference for Oracle . For Oracle there is no equivalent in Snowflake Scripting.
Cursors are pointers that allow users to iterate through query results. For more information on Oracle Cursors check .
Cursor Definition
Cursor Open
Cursor Fetch
Cursor Close
Cursor Attributes
Cursor FOR Loop
Cursor Declaration
Cursor Open
Cursor Fetch
Cursor Close
Cursor FOR Loop
You can use "?" In the filter condition of the cursor at the declaration section define the bind variable. While opening the cursor we can add the additional syntax “USING <bind_variable_1 >” to pass the bind variable.
Below are some examples of scenarios that can occur in the use of parameters in cursors:
Cursors can be controlled through the use of the FOR statement, allowing each and every record of a cursor to be processed while the FETCH statement puts, record by record, the values returned by the cursor into a set of variables, which may be PLSQL records
The Cursor Declaration for Snowflake Scripting does not include this clause. It can be removed from the Oracle Cursor definition to get functional equivalence.
Even though arguments can be declared for a cursor, their values cannot be assigned in Snowflake Scripting. The best alternative is to use the USING
clause with bind variables.
Oracle cursors have different attributes that allow the user to check their status like if it is opened or the amount of fetched rows, however, these attributes regarding the cursor status do not exist in Snowflake Scripting.
In Oracle can be used, before the first fetch from an open cursor, cursor_name%NOTFOUND returns TRUE if the last fetch failed to return a row, or FALSE if the last fetch returned a row. Snowflake Scripting does not support the use of this attribute instead it can be validated if the variable assigned to the cursor result contains values
Snowflake Scripting has support for cursors, however, they have fewer functionalities compared to Oracle. To check more information regarding these cursors, check .
Snowflake Scripting does not support records. However, it is possible to migrate them using the OBJECT data type and the OBJECT_CONSTRUCT() method. For more information please see the .
Snowflake Scripting does not support the BULK COLLECT INTO clause. However, it is possible to use ARRAY_AGG along with a temporal table to construct a new variable with the data corresponding to the Cursor information. For more information please see the .
In Oracle, the query in the cursor declaration has access to procedure variables and parameters but in Snowflake Scripting, it does not. The alternative to this is to use the USING
clause with bind variables. For more information check .
: Data type converted to another data type.
: Columns from expression not found.
: Types resolution issues, the arithmetic operation may not behave correctly between string and date.
: Fetch inside a loop is considered a complex pattern, this could degrade Snowflake performance.
: This statement has usages of cursor for loop.