Conditional Compilation

Translation reference to convert Oracle Conditional Compilation statement to Snowflake Scripting

Description

Provides conditional compilation based on the truth value of a condition.

For more information regarding Oracle Conditional Compilation IF, check here.

$IF conditional_expression $THEN
     statement
     [ statement ]... 
[ $ELSIF conditional_expression $THEN
     statement
     [ statement ]... ]...
[ $ELSE   
     statement
     [ statement ]... ]
$END;

Sample Source Patterns

Possible IF variations

Oracle

IN -> Oracle_01.sql
CREATE OR REPLACE PROCEDURE PROCEDURE_DEMO ()
   AS
   BEGIN
      SELECT 2 FROM DUAL;
      $IF $$debug_flag
      $THEN
         SELECT 1 FROM DUAL;
      $END
   END PROCEDURE_DEMO;

Snowflake Scripting

OUT -> Oracle_01.sql
CREATE OR REPLACE PROCEDURE PROCEDURE_DEMO ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
   BEGIN
      SELECT 2 FROM DUAL;
      !!!RESOLVE EWI!!! /*** SSC-EWI-0073 - PENDING FUNCTIONAL EQUIVALENCE REVIEW FOR 'DOLLAR IF STATEMENT' NODE ***/!!!
      $IF $$debug_flag
      $THEN
         SELECT 1 FROM DUAL;
      $END
   END;
$$;

Known issues

  1. Transformation of Conditional Compilation is not currently supported.

Last updated