MSCEWI3127

Column Alias Removed

This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.

Severity

Low

Description

This warning is used to indicate that the alias of a column is removed because it is not necessary for the Snowflake equivalent. An example is when transforming a SELECT INTO statement if the target is a RECORD or ROWTYPE variable, in this case, the aliases of the columns are not necessary.

Example Code

Input Code

create table f_employee(id number, empname varchar2(23));

CREATE OR REPLACE PROCEDURE sp_sample1 AS
   update_record f_employee%rowtype;
BEGIN
   SELECT id AS "ALIAS1", empname AS "ALIAS2" INTO update_record FROM f_employee WHERE id = 3 FETCH NEXT 1 ROWS ONLY;
END;

Output Code

CREATE OR REPLACE TABLE PUBLIC.f_employee (
   id NUMBER(38, 18) /*** MSC-WARNING - MSCEWI1066 - NUMBER TYPE COLUMN MAY NOT BEHAVE SIMILARLY IN SNOWFLAKE ***/,
   empname VARCHAR(23) /*** MSC-WARNING - MSCEWI1036 - VARCHAR2 DATA TYPE CONVERTED TO VARCHAR ***/
);

CREATE OR REPLACE PROCEDURE PUBLIC.sp_sample1 ()
RETURNS VARCHAR
LANGUAGE SQL
EXECUTE AS CALLER
AS
$$
   DECLARE
      update_record OBJECT /*** MSC-WARNING - MSCEWI1036 - ROWTYPE DATA TYPE CONVERTED TO OBJECT ***/ := OBJECT_CONSTRUCT();
   BEGIN
      SELECT
         OBJECT_CONSTRUCT('id', id /*** MSC-WARNING - MSCEWI3127 - COLUMN ALIAS "ALIAS1" REMOVED, NOT REQUIRED FOR THIS TRANSFORMATION ***/, 'empname', empname /*** MSC-WARNING - MSCEWI3127 - COLUMN ALIAS "ALIAS2" REMOVED, NOT REQUIRED FOR THIS TRANSFORMATION ***/)
      INTO update_record FROM
         PUBLIC.f_employee
      WHERE id = 3
      FETCH NEXT 1 ROWS ONLY;
   END;
$$;

Recommendations

Last updated