--Additional Params: -t JavaScriptCREATEORREPLACEPROCEDURE PROC1IS MyVariable1 NUMBER; MyOtherVariable2 NUMBER :=1;CURSOR C1 ISSELECT*FROM Table1 WHERE ID =123;CURSOR C2 (paramCursor1 NUMBER) ISSELECT COL1 AS C_1 FROM TABLE1 WHERE ID = paramCursor1;BEGINFOR myCursorRecord IN C1LOOP MyVariable1 := myCursorRecord.Col1;ENDLOOP;FOR myCursorRecord IN (SELECT*FROM Table1 WHERE ID = MyVariable1)LOOP MyVariable1 := myCursorRecord.Col1;ENDLOOP;<<Block1>>FOR myCursorRecord IN C2 (MyOtherVariable2)LOOP MyVariable1 := myCursorRecord.Col1;ENDLOOP Block1;END;
Snowflake
SnowConvert helpers Code removed from the example. You can find them here.
OUT -> Oracle_01.sql
CREATEORREPLACEPROCEDURE PROC1 ()RETURNS STRINGLANGUAGE JAVASCRIPTCOMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
EXECUTEASCALLERAS$$// SnowConvert Helpers Code section is omitted. let MYVARIABLE1; let MYOTHERVARIABLE2 =1; let C1 = new CURSOR(`SELECT * FROM Table1 WHERE ID = 123`,() => []); // ** SSC-EWI-0022 - ONE OR MORE IDENTIFIERS IN THIS STATEMENT WERE CONSIDERED PARAMETERS BY DEFAULT. REFERENCED TABLE NOT FOUND. **
let C2 = new CURSOR(`SELECT COL1 AS C_1 FROM TABLE1 WHERE ID = ?`,(PARAMCURSOR1) => [PARAMCURSOR1]); C1.OPEN();while ( C1.NEXT() ) { let MYCURSORRECORD = C1.CURRENT; MYVARIABLE1 = MYCURSORRECORD.COL1; } C1.CLOSE(); // ** SSC-EWI-0022 - ONE OR MORE IDENTIFIERS IN THIS STATEMENT WERE CONSIDERED PARAMETERS BY DEFAULT. REFERENCED TABLE NOT FOUND. **
for(var MYCURSORRECORD_CURSOR = new CURSOR(`(SELECT * FROM Table1 WHERE ID = ?)`,[MYVARIABLE1]).OPEN();MYCURSORRECORD_CURSOR.NEXT();) { let MYCURSORRECORD = MYCURSORRECORD_CURSOR.CURRENT; MYVARIABLE1 = MYCURSORRECORD.COL1; } MYCURSORRECORD_CURSOR.CLOSE(); C2.OPEN({ binds : [MYOTHERVARIABLE2] });while ( C2.NEXT() ) { let MYCURSORRECORD = C2.CURRENT; MYVARIABLE1 = MYCURSORRECORD.COL1; } C2.CLOSE();$$;