Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!drn.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.stanford.edu!sn-xit-02!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
From: DA Morgan <damorgan@x.washington.edu>
Newsgroups: comp.databases.oracle.server
Subject: Re: Insert data into varray
Date: Thu, 28 Apr 2005 21:47:32 -0700
Organization: Ye 'Ol Disorganized NNTPCache groupie
Message-ID: <1114749818.217784@yasure>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
X-Accept-Language: en-us, en
MIME-Version: 1.0
References: <bfa38817.0504281237.6326@posting.google.com>
In-Reply-To: <bfa38817.0504281237.6326@posting.google.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Cache-Post-Path: yasure!unknown@oracle.advtechserv.com
X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/)
X-Complaints-To: abuse@supernews.com
Lines: 59
Xref: dp-news.maxwell.syr.edu comp.databases.oracle.server:241571

Marcin 'dethar' Jurasz wrote:

> Hi! Into my database (its part below), i'm trying to insert values. 
> 
> CREATE TYPE t_vphonenos AS VARRAY(3) OF VARCHAR2(15);
> 
> CREATE OR REPLACE TYPE t_customer AS OBJECT (
>  id           number(4),
>  name_1       varchar2(20),
>  name_2       varchar2(20),
>  surname      varchar2(20),
>  nip          varchar2(13),
>  regon        varchar2(15),
>  pesel        varchar2(11),
>  phone_nos    t_vphonenos
> );
> /
> 
> CREATE TABLE tab_customers OF t_customer (
>  id PRIMARY KEY
> )
> OBJECT ID PRIMARY KEY
> /
> 
> this works fine:
> 
> INSERT INTO tab_customers VALUES(t_customer
> (1, 'Grzegorz', 'Adam', 'Jarzebski', '567nip', '678regon', '568pesel',
> t_adress('Osinska', '23', '24', 'Tuwima', '32-424', 'Towowka'),
> t_vphonenos('+48 565 565 565')));
> 
> but now i'd like to insert ("add") some data into t_vphonenos (i've
> inserted one row already ;)). i've tried something like this, but it
> didn't work:
> 
> INSERT INTO tab_customers (phone_nos) VALUES (
>                                             t_vphonenos ( 
>                                                      ('123123123'),
>                                                      ('345345345')
>                                                    )
>                                             );
> What i'm doing wrong? I've tried also:
> 
> INSERT INTO TABLE (SELECT phone_nos FROM tab_customers WHERE id = 1)
> VALUES (t_vphonenos('123123','1231233'));
> 
> Still doesn't work. Someone would help me? 
> 
> Thanks

Examples of how to do this can be found at:
http://www.psoug.org
click on Morgan's Library
click on nested tables
-- 
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)
