Assign

Description

Assigns a value to a variable.

Click here to navigate to the PostgreSQL documentation page for this syntax.

Assign is supported by Snowflake.

Grammar Syntax

VARIABLE NAME { = |:= } expr

Sample Source Patterns

Input

The only change required, is the following

VARIABLE_NAME = expr;
VARIABLE_NAME := expr;

VARIABLE_NAME := count(*);

Special cases

Postgresql allows a select body to be on the right-hand side of an assignment, without the SELECT keyword. Snowflake needs the whole select statement, and SnowConvert automatically adds the missing keyword and parenthesis.

VARIABLE_NAME := COUNT(*) FROM TB1;

Known Issues

No issues were found.

No related EWIs.

Last updated