FETCH CURSOR

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Description

Retrieves rows using a cursor. (Redshift SQL Language reference Fetch)

Transformation information

FETCH [ NEXT | ALL | {FORWARD [ count | ALL ] } ] FROM cursor

FETCH cursor INTO target [, target ...];

Sample Source Patterns

Setup data

Redshift

CREATE TABLE cursor_example
(
	col1 INTEGER,
	col2 VARCHAR(20)
);

INSERT INTO cursor_example VALUES (10, 'hello');

Snowflake

Fetch into

The FETCH into statement from Redshift is fully equivalent in Snowflake

Redshift

Snowflake

Known Issues

1. Fetch without target variables is not supported

Snowflake requires the FETCH statement to specify the INTO clause with the variables where the fetched row values are going to be stored. When a FETCH statement is found in the code with no INTO clause an EWI will be generated.

Input Code:

Output Code:

Known Issues

There are no known issues.

  1. SSC-EWI-PG0015: Fetch cursor without target variables is not supported in Snowflake

Last updated