# Local Variables and Parameters

{% hint style="info" %}
**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](https://docs.snowflake.com/en/migrations/snowconvert-docs/translation-references/redshift/README)

For any immediate assistance or if you encounter any issues, please contact our support team at [snowconvert-support@snowflake.com](mailto:snowconvert-support@snowflake.com).

Thank you for your understanding.
{% endhint %}

## Description

> Redshift also allow to SELECT INTO variables when the statement is executed inside stored procedures.

{% hint style="success" %}
This pattern is fully supported in Snowflake.
{% endhint %}

## Grammar Syntax

```sql
SELECT [ select_expressions ] INTO target [ select_expressions ] FROM ...;
```

## Sample Source Patterns

### SELECT INTO with expressions at the left

#### Input Code:

{% tabs %}
{% tab title="Redshift" %}
{% code title="IN -> Redshift_01.sql" %}
```sql
CREATE OR REPLACE PROCEDURE test_sp1(out param1 int)
AS $$
DECLARE
    var1 int;
BEGIN
     select 10, 100 into param1, var1;
END;
$$ LANGUAGE plpgsql;
```
{% endcode %}
{% endtab %}

{% tab title="Results" %}
| param1 |
| ------ |
| 10     |
{% endtab %}
{% endtabs %}

#### Output Code:

{% tabs %}
{% tab title="Snowflake" %}
{% code title="OUT -> Redshift_01.sql" overflow="wrap" %}
```sql
CREATE OR REPLACE PROCEDURE test_sp1 (param1 OUT int)
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "07/16/2025",  "domain": "no-domain-provided" }}'
AS $$
        DECLARE
            var1 int;
BEGIN
     select 10, 100 into
                : param1,
                : var1;
END;
$$;

```
{% endcode %}
{% endtab %}

{% tab title="Results" %}
| TEST\_SP1        |
| ---------------- |
| { "param1": 10 } |
{% endtab %}
{% endtabs %}

### SELECT INTO with expressions at the right

#### Input Code:

{% tabs %}
{% tab title="Redshift" %}
{% code title="IN -> Redshift_02.sql" %}
```sql
CREATE OR REPLACE PROCEDURE test_sp1(out param1 int)
AS $$
DECLARE
    var1 int;
BEGIN
     select into param1, var1 10, 100;
END;
$$ LANGUAGE plpgsql;
```
{% endcode %}
{% endtab %}

{% tab title="Results" %}
| param1 |
| ------ |
| 10     |
{% endtab %}
{% endtabs %}

#### Output Code:

Since Snowflake doesn't support this grammar for SELECT INTO, the expressions are moved to the left of the INTO.

{% tabs %}
{% tab title="Snowflake" %}
{% code title="OUT -> Redshift_02.sql" overflow="wrap" %}
```sql
CREATE OR REPLACE PROCEDURE test_sp1 (param1 OUT int)
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "07/16/2025",  "domain": "no-domain-provided" }}'
AS $$
        DECLARE
            var1 int;
BEGIN
     select
                10, 100
            into
                : param1,
                : var1;
END;
$$;
```
{% endcode %}
{% endtab %}

{% tab title="Results" %}
| TEST\_SP1        |
| ---------------- |
| { "param1": 10 } |
{% endtab %}
{% endtabs %}

## Known Issues

There are no known issues.

## Related EWIs.

There are no related EWIs.
