I am trying to create a Snowflake equivalent to the below T-SQL based adhoc query.
**T-SQL version**
Declare @i int = 0;
If(@i = 0)
PRINT '0';
Else
Begin
PRINT '1'
RETURN;
PRINT '2'
End
**Snowflake version**
Set i = 0;
If($i = 0)
Select '0';
Else
Begin
Select '1'
RETURN;
Select '2'
End
When I am running the Snowflake query from the Snowflake Web UI, I am getting an error as SQL compilation error : syntax error line 1 at position 0 unexpected 'IF'
I have searched the snowflake documentation and did not find helpful documentation for:
- If Else
- Begin End
- Return
Any help would be appreciated.
Thank you.