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

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.