Re: And again: 1NF may not be dead
From: Kenneth Downs <firstinit.lastname_at_lastnameplusfam.net>
Date: Wed, 27 Oct 2004 13:04:08 -0400
Message-ID: <9ekolc.9oe.ln_at_mercury.downsfam.net>
>
> Yes, for arrays and nested tables:
>
> SQL> create table t (name varchar2(10));
> SQL> create type name_tab_type as table of varchar2(10);
> 2 /
> SQL> declare
> 2 name_tab name_tab_type := name_tab_type ('abc','xyz','123');
> 3 begin
> 4 insert into t select * from table(cast(name_tab as
> name_tab_type));
> 5 end;
> 6 /
> SQL> select * from t;
>
> NAME
> ----------
> abc
> xyz
> 123
Date: Wed, 27 Oct 2004 13:04:08 -0400
Message-ID: <9ekolc.9oe.ln_at_mercury.downsfam.net>
Tony Andrews wrote:
>> Does Oracle's language do such things?
>
> Yes, for arrays and nested tables:
>
> SQL> create table t (name varchar2(10));
> SQL> create type name_tab_type as table of varchar2(10);
> 2 /
> SQL> declare
> 2 name_tab name_tab_type := name_tab_type ('abc','xyz','123');
> 3 begin
> 4 insert into t select * from table(cast(name_tab as
> name_tab_type));
> 5 end;
> 6 /
> SQL> select * from t;
>
> NAME
> ----------
> abc
> xyz
> 123
Hmmm, looks good.
On line 4, why did you have to cast(name_tab as name_tab_type), didn't you declare it as such? I guess I'm wondering why you couldn't just do:
INSERT INTO t SELECT * from name_tab;
or even just
SELECT * FROM name_tab
-- Kenneth Downs Use first initial plus last name at last name plus literal "fam.net" to email meReceived on Wed Oct 27 2004 - 19:04:08 CEST