GOTO statement was removed due to if statement inversion.
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:
For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].
Thank you for your understanding.
This EWI is deprecated, please refer to SSC-FDM-TD0026 documentation
Some parts in the output code are omitted for clarity reasons.
Severity
Medium
Description
It is common to use GOTO command with IF and LABEL commands to replicate the functionality of an SQL if statement. When used in this way, it is possible to transform them directly into an if, if-else, or even an if-elseif-else statement. However, in these cases, the GOTO commands become unnecessary and should be removed to prevent them from being replaced by a LABEL section.
Example Code
Input Code:
-- Additional Params: --scriptsTargetLanguage SnowScript.If ActivityCount =0THEN .GOTO endIfDROPTABLE TABLE1;.Label endIfSELECT A FROM TABLE1;
EXECUTE IMMEDIATE
$$
DECLARE
STATUS_OBJECT OBJECT := OBJECT_CONSTRUCT('SQLCODE', 0);
BEGIN
IF (NOT (STATUS_OBJECT['SQLROWCOUNT'] = 0)) THEN
!!!RESOLVE EWI!!! /*** SSC-EWI-TD0087 - GOTO endIf WAS REMOVED DUE TO IF STATEMENT INVERSION ***/!!!
BEGIN
DROP TABLE TABLE1;
STATUS_OBJECT := OBJECT_CONSTRUCT('SQLROWCOUNT', SQLROWCOUNT);
EXCEPTION
WHEN OTHER THEN
STATUS_OBJECT := OBJECT_CONSTRUCT('SQLCODE', SQLCODE, 'SQLERRM', SQLERRM, 'SQLSTATE', SQLSTATE);
END;
END IF;
/*.Label endIf*/
--** SSC-FDM-0027 - REMOVED NEXT STATEMENT, NOT APPLICABLE IN SNOWFLAKE. **
BEGIN
SELECT
A
FROM
TABLE1;
STATUS_OBJECT := OBJECT_CONSTRUCT('SQLROWCOUNT', SQLROWCOUNT);
EXCEPTION
WHEN OTHER THEN
STATUS_OBJECT := OBJECT_CONSTRUCT('SQLCODE', SQLCODE, 'SQLERRM', SQLERRM, 'SQLSTATE', SQLSTATE);
END;
END
$$