Varray Type Definition
This is a translation reference to convert the Oracle Varray Declaration to Snowflake
This section is a work in progress, information may change in the future.
Description
A varray (variable-size array) is an array whose number of elements can vary from zero (empty) to the declared maximum size.
To access an element of a varray variable, use the syntax
variable_name(index). The lower bound ofindexis 1; the upper bound is the current number of elements. The upper bound changes as you add or delete elements, but it cannot exceed the maximum size. When you store and retrieve a varray from the database, its indexes and element order remain stable.
For the translation, the type definition is replaced by an ARRAY Semi-structured Data Type and then its usages are changed accordingly across any operations. Please note how the translation for Nested Tables and Varrays are the same.
In order to define a varray type, the syntax is as follows:
type_definition := { VARRAY | [VARYING] ARRAY } (size_limit) OF datatype
[NOT NULL];To declare a variable of this type:
Sample Source Patterns
Varray definitions
This illustrates how three different ways to create a varray, and how to migrate these definitions for the variables.
Oracle
Snowflake
Varray iteration
Oracle
Snowflake
Known Issues
1. They are currently not being converted
SnowConvert does not support translating these elements.
2. Indexing needs to be modified
Oracle's indexes start at 1, on Snowflake they will begin at 0.
3. Array Density may not match the original
Since the ARRAY datatype can become sparse, care should be taken when performing additions or deletions of the array. Using ARRAY_COMPACT() after such operations can be helpful if the density is a concern.
Related EWIs
SSC-EWI-0058: Functionality is not currently supported by Snowflake Scripting.
SSC-EWI-0062: Custom type usage changed to variant.
SSC-EWI-0073: Pending Functional Equivalence Review.
SSC-EWI-OR0108: The Following Assignment Statement is Not Supported by Snowflake Scripting.
SSC-FDM-OR0035: DBMS_OUTPUT.PUTLINE check UDF implementation.
Last updated
