Getting Information on a Varray
CREATE TYPE t_varray AS VARRAY(3) OF VARCHAR2(50);
/
SQL> DESCRIBE t_varray
t_varray VARRAY(10) OF VARCHAR2(50)
SQL>
CREATE TABLE emp(
id INTEGER PRIMARY KEY,
first_name VARCHAR2(10),
last_name VARCHAR2(10),
addresses t_varray
);
SQL> DESCRIBE emp
Name Null? Type
----------------------------------------- -------- ------------------------
ID NOT NULL NUMBER(38)
FIRST_NAME VARCHAR2(10)
LAST_NAME VARCHAR2(10)
ADDRESSES T_VARRAY
SQL>
The user_varrays
view has the information on varray:
SQL> desc user_varrays;
Name Null? Type
----------------------------------------- -------- ------------------------
PARENT_TABLE_NAME VARCHAR2(30)
PARENT_TABLE_COLUMN VARCHAR2(4000)
TYPE_OWNER VARCHAR2(30)
TYPE_NAME VARCHAR2(30)
LOB_NAME VARCHAR2(30)
STORAGE_SPEC VARCHAR2(30)
RETURN_TYPE VARCHAR2(20)
ELEMENT_SUBSTITUTABLE VARCHAR2(25)
SQL> SELECT parent_table_name,
2 parent_table_column,
3 type_name
4 FROM user_varrays
5 WHERE type_name = 'T_VARRAY';
PARENT_TABLE_NAME PARENT_TABLE_COLUMN TYPE_NAME
----------------------------------------------------------
EMP ADDRESSES T_VARRAY
Home »
Oracle »
PL/SQL »
Oracle »
PL/SQL »
Varrays:
- Creating a Varray Type
- Using a Varray Type to Define a Column
- Getting Information on a Varray
- Populating a Varray with Elements
- Retrieving Elements from a Varray
- Using TABLE() to Treat a VArrays
- Modifying Elements of a Varray
Related: