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.
This section is for the PL/SQL Version of the Varrays, for the Standalone Version please see Array Type Definition.
Some parts in the output code are omitted for clarity reasons.
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 ofindex
is 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:
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
Note that a UDF was added to implement the functionality for the update of the element.
This UDF will be added in later revisions.