Creating a VARRAY Type in an Oracle Database
A VARRAY is a variable-length ordered list of values of one type.
This example creates a VARRAY that can hold up to ten NUMBER values.
try {
Statement stmt = connection.createStatement();
// Create a 10-element VARRAY of NUMBERs
stmt.execute("CREATE TYPE number_varray AS VARRAY(10) OF NUMBER(12, 2)");
// Create a table with a column to hold the new VARRAY type
stmt.execute("CREATE TABLE VARRAY_TABLE(col_number_array number_varray)");
} catch (SQLException e) {
}
Post a comment