Cursor Variables

Translation reference for cursor variables and the OPEN FOR statement

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.

Some parts in the output code are omitted for clarity reasons.

Description

A cursor variable is like an explicit cursor that is not limited to one query.

(Oracle PL/SQL Language Reference Cursor Variable Declaration)

Ref cursor type definition

TYPE type IS REF CURSOR
  [ RETURN
    { {db_table_or_view | cursor | cursor_variable}%ROWTYPE
    | record%TYPE
    | record_type
    | ref_cursor_type
    }
  ] ;

Cursor variable declaration

cursor_variable type;

OPEN FOR statement

OPEN { cursor_variable | :host_cursor_variable}
  FOR select_statement [ using_clause ] ;

Sample Source Patterns

1. OPEN FOR statement with dynamic SQL inside a VARCHAR variable

2. OPEN FOR statement with dynamic SQL inside a string literal.

3. OPEN FOR statement with SELECT statement

4. Cursor Variable declared with REF CURSOR type

5. OPEN FOR statement with USING clause

Known Issues

No issues were found.

  1. SSC-EWI-0030: The statement below has usages of dynamic SQL.

  2. SSC-EWI-0058: Functionality is not currently supported by Snowflake Scripting.

Last updated