SSC-EWI-0001

Unrecognized token on the line of the source code.

Some parts in the output code are omitted for clarity reasons.

Severity

Critical

Description

This issue occurs when there is an error while parsing the source code that is being converted. It means there is a source code syntax error or a specific statement of the code is not being recognized yet.

Example Code

The following example illustrates different parsing error scenarios where invalid syntax is placed in the input. Notice how the message varies between every scenario, these contents may be helpful on isolating and fixing the issue. For more information check "Message Contents" below.

Input Code:

IN -> Teradata_01.sql
CRATE;

CREATE TABLE someTable(col1 INTEGER, !);

CREATE TABRE badTable(col1 INTEGER);

CREATE PROCEDURE proc1()
BEGIN
    CREATE TABLE badEmbeddedTable(col1 INTEGER);
END;

Output Code:

OUT -> Teradata_01.sql
-- ** SSC-EWI-0001 - UNRECOGNIZED TOKEN ON LINE '1' COLUMN '1' OF THE SOURCE CODE STARTING AT 'CRATE'. EXPECTED 'STATEMENT' GRAMMAR. LAST MATCHING TOKEN WAS 'CRATE' ON LINE '1' COLUMN '1'. CODE '81'. **
--CRATE
     ;

CREATE OR REPLACE TABLE someTable (
    col1 INTEGER
--                ,
                 
-- ** SSC-EWI-0001 - UNRECOGNIZED TOKEN ON LINE '3' COLUMN '37' OF THE SOURCE CODE STARTING AT '!'. EXPECTED 'Column Definition' GRAMMAR. LAST MATCHING TOKEN WAS ',' ON LINE '3' COLUMN '35'. FAILED TOKEN WAS '!' ON LINE '3' COLUMN '37'. CODE '15'. **
--                  !
                   )
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "teradata",  "convertedOn": "07/04/2024" }}'
;

-- ** SSC-EWI-0001 - UNRECOGNIZED TOKEN ON LINE '5' COLUMN '1' OF THE SOURCE CODE STARTING AT 'CREATE'. EXPECTED 'STATEMENT' GRAMMAR. LAST MATCHING TOKEN WAS 'CREATE' ON LINE '5' COLUMN '1'. CODE '81'. **
--CREATE TABRE badTable(col1 INTEGER)
                                   ;

CREATE OR REPLACE PROCEDURE proc1 ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "teradata",  "convertedOn": "07/04/2024" }}'
EXECUTE AS CALLER
AS
$$
    BEGIN
        CREATE OR REPLACE TABLE badEmbeddedTable (
            col1 INTEGER);
    END;
$$;

Message Contents

  1. Starting clause: Specifies the starting location (line, column, and 'text') of the unrecognized code. The code will be commented from the 'text' element onward for every unrecognized element until the parser locates a possible recovery point.

  2. Expected grammar clause: Specifies the type of grammar that the parser was expecting. Check if the commented code has a matching type of the expected grammar.

  3. Last matching token clause (OPTIONAL): May appear if the unrecognized code was partially recognized. This signals the point up until the parser recognized valid elements, so check the following tokens in the commented code to make sure they are valid.

  4. Failed Token clause (OPTIONAL): May only be present when a "Last matching Token clause" is also present. This represents at which point the parser ultimately determined the code is invalid or not recognized. Make sure this element can be placed in this syntactical location.

  5. Recovery Code: It is intended to be used as an error code, and may be supplied for better support during parser upgrade requests. It represents how the parser triggered its recovery mechanism.

Recommendations

  • Check if the source code has the correct syntax.

  • The message can be used to isolate and solve the issue.

  • If the syntax is not supported, it may be manually changed to a supported syntax.

  • If you need more support, you can email us at snowconvert-support@snowflake.com

Last updated