Multiples IFs statement

circle-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 Documentationarrow-up-right

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected]envelope.

Thank you for your understanding.

This pattern defines a function that uses conditional statements over local variables.

Components:

  1. Function Declaration:

    • CREATE FUNCTION functionName(parameters) RETURN returnType

    • Declares the function with input parameters and the return type.

  2. Variable Declaration:

    • Declares variables, including the return variable.

  3. BEGIN-END Block with IF Statement:

    • Check if a condition is true.

    • Each case is used to assign a value over the same variable.

Conversion:

DECLARE SECTION : variables with default an expression are moved to a common table expression.

IF/ELSE statement can be handled using the CASE EXPRESSIONarrow-up-right inside the select allowing conditionals inside the queries.

RETURN statement is transformed to the final select.

Known Issues

No issues were found.

  1. SSC-FDM-OR0042: Date Type Transformed To Timestamp Has A Different Behavior.

  2. SSC-EWI-0073: Pending Functional Equivalence Review.

  3. SSC-EWI-OR0036: Types resolution issues, the arithmetic operation may not behave correctly between string and date.

Last updated