CURSOR
Translation reference to convert Teradata CURSOR statement to Snowflake Scripting
Last updated
Translation reference to convert Teradata CURSOR statement to Snowflake Scripting
Last updated
A cursor is a data structure that is used by stored procedures at runtime to point to a resultset returned by an SQL query. For more information check .
The following code is necessary to execute the sample patterns present in this section.
The following procedure is intended to return one result set since it has the DYNAMIC RESULT SETS 1
property in the header, the cursor has the WITH RETURN
property and is being opened in the body.
The following procedure is intended to return multiple results when DYNAMIC RESULT SETS
property in the header is greater than 1, the procedure has multiple cursors with the WITH RETURN
property and these same cursors are being opened in the body.
The following cursor uses binding variables as the were condition to perform the query.
It is a type of loop that uses a cursor to fetch rows from a SELECT statement and then performs some processing on each row.
It allows one to retrieve rows from a result set one at a time and perform some processing on each row.
The following parameters are not applicable in Snowflake Scripting.
[ SCROLL/NO SCROLL ] Snowflake Scripting only supports FETCH NEXT.
[ READ-ONLY ] This is the default in Snowflake Scripting.
[ UPDATE ].
[ NEXT ] This is the default behavior in Snowflake Scripting.
[ FIRST ].
: Multiple result sets are returned in temporary tables.
: Fetch inside a loop is considered a complex pattern, this could degrade Snowflake performance.
: This statement has usages of cursor for loop.