SELECT INTO Statement

Translation reference to convert Oracle SELECT INTO statement to Snowflake Scripting

Description

The SELECT INTO statement retrieves values from one or more database tables (as the SQL SELECT statement does) and stores them in variables (which the SQL SELECT statement does not do). (Oracle PL/SQL Language Reference SELECT INTO Statement)

SELECT [ { DISTINCT | UNIQUE } | ALL ] select_list
    { into_clause | bulk_collect_into_clause } FROM rest-of-statement ;
SELECT [ { ALL | DISTINCT } ]
    {
          [{<object_name>|<alias>}.]*
        | [{<object_name>|<alias>}.]<col_name>
        | [{<object_name>|<alias>}.]$<col_position>
        | <expr>
        [ [ AS ] <col_alias> ]
    }
    [ , ... ]
    INTO :<variable> [, :<variable> ... ]
    [...]

Sample Source Patterns

Sample auxiliary data

This code was executed to a better understanding of the examples:

SELECT INTO Statement simple case

Oracle

Snowflake Scripting

Known Issues

1. BULK COLLECT INTO is not supported

Snowflake Scripting does not support the BULK COLLECT INTO clause. However, it is possible to use ARRAY_AGG to construct a new variable. For more information please see the Collection Bulk Operations Section.

2. Collections and records are not supported

Snowflake Scripting does not support the use of collections nor records. It is possible to migrate them using Semi-structured data types as explained in this section.

  1. MSCEWI1058: Functionality is not currently supported by Snowflake Scripting

Last updated

Was this helpful?