--Additional Params: -t JavaScriptCREATEORREPLACEPROCEDURE PROC_RECORDSISTYPE DEPTRECTYP IS RECORD ( DEPT_ID NUMBER(4) NOT NULL :=10, DEPT_NAME VARCHAR2(30) NOT NULL :='ADMINISTRATION', MGR_ID NUMBER(6) :=200, LOC_ID NUMBER(4) :=1700 );TYPE NAME_REC IS RECORD (FIRST EMPLOYEES.FIRST_NAME%TYPE,LAST EMPLOYEES.LAST_NAME%TYPE );TYPE CONTACT IS RECORD (NAME NAME_REC,-- NESTED RECORD PHONE EMPLOYEES.PHONE_NUMBER%TYPE );BEGINnull;END;
--Additional Params: -t JavaScriptCREATEORREPLACEPROCEDURE ROWTYPE_PROC AS varname number :=1;CURSOR BOOK_CURSOR ISSELECT*FROM BOOK where1= varname; BOOK_REC BOOK%ROWTYPE; BOOK_CUR_REC BOOK_CURSOR%ROWTYPE;BEGIN BOOK_REC.ID :=10; BOOK_REC.TITLE :='A STUDY IN SCARLET'; BOOK_REC.AUTHOR :='SIR ARTHUR CONAN DOYLE';INSERT INTO BOOK VALUES(BOOK_REC.ID, BOOK_REC.TITLE, BOOK_REC.AUTHOR);OPEN BOOK_CURSOR;FETCH BOOK_CURSOR INTO BOOK_CUR_REC;CLOSE BOOK_CURSOR;END;
Snowflake
OUT -> Oracle_03.sql
CREATEORREPLACEPROCEDURE ROWTYPE_PROC ()RETURNS STRINGLANGUAGE JAVASCRIPTCOMMENT ='{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'EXECUTEASCALLERAS$$// SnowConvert Helpers Code section is omitted. let VARNAME =1; let BOOK_CURSOR = new CURSOR(`SELECT * FROM BOOK where 1 = ?`,() => [VARNAME]); let BOOK_REC = ROWTYPE(`BOOK`); let BOOK_CUR_REC = BOOK_CURSOR.ROWTYPE(); BOOK_REC.ID =10; BOOK_REC.TITLE =`A STUDY IN SCARLET`; BOOK_REC.AUTHOR =`SIR ARTHUR CONAN DOYLE`;EXEC(`INSERT INTO BOOK VALUES( !!!RESOLVE EWI!!! /*** SSC-EWI-0026 - THE VARIABLE BOOK_REC.ID MAY REQUIRE A CAST TO DATE, TIME OR TIMESTAMP ***/!!! ?, !!!RESOLVE EWI!!! /*** SSC-EWI-0026 - THE VARIABLE BOOK_REC.TITLE MAY REQUIRE A CAST TO DATE, TIME OR TIMESTAMP ***/!!! ?, !!!RESOLVE EWI!!! /*** SSC-EWI-0026 - THE VARIABLE BOOK_REC.AUTHOR MAY REQUIRE A CAST TO DATE, TIME OR TIMESTAMP ***/!!! ?)`,[BOOK_REC.ID,BOOK_REC.TITLE,BOOK_REC.AUTHOR]); BOOK_CURSOR.OPEN(); BOOK_CURSOR.FETCH(BOOK_CUR_REC) && ([BOOK_CUR_REC] = BOOK_CURSOR.INTO()); BOOK_CURSOR.CLOSE();$$;
--Additional Params: -t JavaScriptCREATEORREPLACEPROCEDURE PROC_CURSORSISCURSOR C1 RETURN Table1%ROWTYPE;CURSOR C2 RETURN UserDefinedRecordType;CURSOR C3 RETURN Table1%ROWTYPE ISSELECT*FROM Table1 WHERE ID =110;CURSOR C4 ISSELECT*FROM Table1 WHERE ID =123;CURSOR C5 (cursorParam NUMBER ) RETURN Table1%ROWTYPE ISSELECT*FROM Table1 WHERE ID = cursorParam;BEGINnull;END;
Snowflake
SnowConvert helpers Code removed from the example. You can find them here.
OUT -> Oracle_05.sql
CREATEORREPLACEPROCEDURE PROC_CURSORS ()RETURNS STRINGLANGUAGE JAVASCRIPTCOMMENT ='{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'EXECUTEASCALLERAS$$// SnowConvert Helpers Code section is omitted. let C1 = new CURSOR(); let C2 = new CURSOR(); let C3 = new CURSOR(`SELECT * FROM Table1 WHERE ID = 110`,() => []); let C4 = new CURSOR(`SELECT * FROM Table1 WHERE ID = 123`,() => []);//** SSC-EWI-0022- ONE OR MORE IDENTIFIERS IN THIS STATEMENT WERE CONSIDERED PARAMETERS BYDEFAULT. REFERENCED TABLENOT FOUND. ** let C5 = new CURSOR(`SELECT * FROM Table1 WHERE ID = ?`,(CURSORPARAM) => [CURSORPARAM]);null;$$;
EWIs Related
SSC-EWI-0022: One or more identifiers in this statement were considered parameters by default.
SSC-EWI-0026: The variable may requiere a cast to date, time or timestamp.