SSC-EWI-SY0007

DML Derived Table not supported in Snowflake.

Severity

High

Description

In Sybase, during execution, the DML statement specified in the dml-derived table is executed first, and the rows affected by that DML materialize into a temporary table whose columns are described by the REFERENCING clause. The temporary table represents the result set of dml-derived-table. Snowflake does not support this behavior.

Code Examples

Input Code:

IN -> Sybase_01.sql
SELECT * FROM (INSERT INTO TABLE1 (Col1, Col2) VALUES (1, 'test')) REFERENCING (FINAL AS F);
SELECT * FROM (DELETE FROM TABLE1) REFERENCING (FINAL AS F);
SELECT * FROM (UPDATE TABLE1 SET A = 1) REFERENCING (FINAL AS F);

Output Code:

OUT -> Sybase_01.sql
SELECT
  *
FROM
  !!!RESOLVE EWI!!! /*** SSC-EWI-SY0007 - DML DERIVED TABLE NOT SUPPORTED IN SNOWFLAKE ***/!!!
  (
    INSERT INTO TABLE1 (Col1, Col2) VALUES (1, 'test')
  )
  REFERENCING
  (FINAL AS F);

SELECT
  *
FROM
  !!!RESOLVE EWI!!! /*** SSC-EWI-SY0007 - DML DERIVED TABLE NOT SUPPORTED IN SNOWFLAKE ***/!!!
  (
    DELETE FROM TABLE1
  )
  REFERENCING
  (FINAL AS F);

SELECT
  *
FROM
  !!!RESOLVE EWI!!! /*** SSC-EWI-SY0007 - DML DERIVED TABLE NOT SUPPORTED IN SNOWFLAKE ***/!!!
  (
    UPDATE TABLE1
      SET
        A = 1
  )
  REFERENCING
  (FINAL AS F);

Recommendations

Last updated