FETCH (Snowflake Scripting)¶
Uses the specified cursor to fetch one or more rows.
For more information on cursors, see Working with Cursors.
FETCH <cursor_name> INTO <variable> [, <variable> ... ] ;
The name of the cursor.
The name of the variable into which to retrieve the value of one column of the current row.
You should have one variable for each column defined in the cursor declaration.
The variable must already have been declared.
The variable’s data type must be compatible with the value to be fetched.
The number of
variables should match the number of expressions selected in the
SELECTclause of the cursor declaration.
If you try to
FETCHa row after the last row, you get NULL values.
A RESULTSET or CURSOR does not necessarily cache all the rows of the result set at the time that the query is executed. FETCH operations can experience latency.