Some parts in the output code are omitted for clarity reasons.
Severity
High
Description
There is no equivalent for FOR UPDATE clause in Snow Scripting so an EWI is added and the clause is commented out
Example Code
Input Code:
IN -> Oracle_01.sql
CREATE OR REPLACE PROCEDURE for_update_clauseAS update_record f_employee%rowtype;CURSOR c1 ISSELECT*FROM f_employee FORUPDATEOF employee_number nowait;BEGINFOR CREC IN C1 LOOPUPDATE f_employee SET employee_number = employee_number +1000WHERE CURRENT OF c1;IF crec.id =2THENDELETEFROM f_employee WHERE CURRENT OF c1;EXIT;END IF;END LOOP;END;
Output Code:
OUT -> Oracle_01.sql
CREATEORREPLACEPROCEDURE for_update_clause ()RETURNSVARCHARLANGUAGESQLCOMMENT ='{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'EXECUTEASCALLERAS$$DECLARE update_record OBJECT !!!RESOLVE EWI!!! /*** SSC-EWI-0036 - ROWTYPE DATA TYPE CONVERTED TO OBJECT ***/!!! := OBJECT_CONSTRUCT(); c1 CURSORFORSELECT*FROM f_employee !!!RESOLVE EWI!!! /*** SSC-EWI-OR0110 - FOR UPDATE CLAUSE IS NOT SUPPORTED IN SNOWFLAKE ***/!!!FORUPDATE OF employee_number nowait;BEGINOPEN C1;--** SSC-PRF-0004 - THIS STATEMENT HAS USAGES OF CURSOR FOR LOOP **FOR CREC IN C1 DO !!!RESOLVE EWI!!! /*** SSC-EWI-OR0136 - CURRENT OF CLAUSE IS NOT SUPPORTED IN SNOWFLAKE ***/!!!UPDATE f_employeeSET employee_number = !!!RESOLVE EWI!!! /*** SSC-EWI-OR0036 - TYPES RESOLUTION ISSUES, ARITHMETIC OPERATION '+' MAY NOT BEHAVE CORRECTLY BETWEEN unknown AND Number ***/!!! employee_number +1000WHERE CURRENT OF c1;IF (crec.id =2) THEN-- !!!RESOLVE EWI!!! /*** SSC-EWI-0058 - FUNCTIONALITY FOR 'CURRENT OF' IS NOT CURRENTLY SUPPORTED BY SNOWFLAKE SCRIPTING ***/!!!-- DELETE FROM-- f_employee-- WHERE CURRENT OF c1 ; EXIT;ENDIF;ENDFOR;CLOSE C1;END;$$;
Recommendations
Handle the column update in the UPDATE/DELETE query for more details check SSC-EWI-0075.