Declarations

This section holds the transformation of declarations that can be made inside procedures or functions.

Variable declaration and assignment

Oracle

CREATE OR REPLACE PROCEDURE PROC_VARIABLES 
IS
  localVar1 NUMBER;
  localVar2 VARCHAR(100);
  localVar3 VARCHAR2 := 'local variable 3';
  localVar4 VARCHAR2 DEFAULT 'local variable 4';
  localVar5 VARCHAR2 NOT NULL := 'local variable 5';
  localVar6 VARCHAR2 NOT NULL DEFAULT 'local variable 6';
  localVar7 NUMBER := NULL;
  localVar8 NUMBER := '';
BEGIN
    localVar1 := 123;
END;

Snowflake

SnowConvert helpers Code removed from the example. You can find them here.

CREATE OR REPLACE PROCEDURE PUBLIC.PROC_VARIABLES ()
RETURNS STRING
LANGUAGE JAVASCRIPT
EXECUTE AS CALLER
AS
$$
   // REGION SnowConvert Helpers Code
   let LOCALVAR1;
   let LOCALVAR2;
   let LOCALVAR3 = `local variable 3`;
   let LOCALVAR4 = `local variable 4`;
   let LOCALVAR5 = `local variable 5`;
   let LOCALVAR6 = `local variable 6`;
   let LOCALVAR7 = undefined;
   let LOCALVAR8 = undefined;
   LOCALVAR1 = 123;
$$;

Record variable declaration

You might also be interested in Records transformation section.

Oracle

Snowflake

SnowConvert helpers Code removed from the example. You can find them here.

Rowtype Record variable declaration

Oracle

Snowflake

SnowConvert helpers Code removed from the example. You can find them here.

Constant Declaration

Oracle

Snowflake

SnowConvert helpers Code removed from the example. You can find them here.

Cursor declarations and definition

Oracle

You might also be interested in Cursor helper

Snowflake

SnowConvert helpers Code removed from the example. You can find them here.

Last updated

Was this helpful?