Loading a Table with a VARRAY in It: INSERT VALUEs with Constants
1 SQL> CREATE OR REPLACE TYPE mem_type IS VARRAY(10) of VARCHAR2(15)
2 2 /
3
4 Type created.
5
6 SQL>
7 SQL> CREATE TABLE club (Name VARCHAR2(10),
8 2 Address VARCHAR2(20),
9 3 City VARCHAR2(20),
10 4 Phone VARCHAR2(8),
11 5 Members mem_type)
12 6 /
13
14 Table created.
15
16 SQL>
17 SQL> INSERT INTO club VALUES ('AL','111 First St.','Mobile',
18 2 '222-2222', mem_type('Brenda','Richard'));
19
20 1 row created.
21
22 SQL>
23 SQL> INSERT INTO club VALUES ('FL','222 Second St.','Orlando',
24 2 '333-3333', mem_type('Gen','John','Steph','JJ'));
25
26 1 row created.
27
28 SQL>
29 SQL> SELECT *
30 2 FROM club;
31
32 NAME ADDRESS CITY PHONE
33 ---------- -------------------------------------------------- -------------------- --------
34 MEMBERS
35 -------------------------------------------------------------------------------------------
36 AL 111 First St. Mobile 222-2222
37 MEM_TYPE('Brenda', 'Richard')
38
39 FL 222 Second St. Orlando 333-3333
40 MEM_TYPE('Gen', 'John', 'Steph', 'JJ')
41
42
43 SQL>
44 SQL>
45 SQL>
46 SQL> drop table club;
47
48 Table dropped.
49
50 SQL> drop type mem_type;
51
52 Type dropped.