Home » RDBMS Server » Server Administration » inserting into nested tables
inserting into nested tables [message #370664] Tue, 18 January 2000 04:31 Go to next message
Sunitha
Messages: 16
Registered: January 2000
Junior Member
Can you pls explain how we can insert data into a table having multiple nested tables. A nested table may have another nested table as a column in it is the scenario.
Re: inserting into nested tables [message #370668 is a reply to message #370664] Tue, 18 January 2000 13:52 Go to previous messageGo to next message
Lee
Messages: 56
Registered: May 1999
Member
try
insert into Table1.Table2 (Col1, Col2)
values (Val1, Val2);
Re: inserting into nested tables [message #370679 is a reply to message #370664] Tue, 18 January 2000 23:51 Go to previous messageGo to next message
Sunitha
Messages: 16
Registered: January 2000
Junior Member
create type test as object
(
testid number(6),
testname varchar2(10)
)

create type testtype is table of test

CREATE or replace TYPE secondnest AS OBJECT
( secondid number(2),
nesttest test
)

create type secondtype is table of secondnest

create table testtable
(
tableno number(3),
address secondtype
)
nested table address store as second_table

With ref. to the example, we want to insert into test table. We could not achieve with your reply. Pls help
Re: inserting into nested tables [message #370681 is a reply to message #370664] Wed, 19 January 2000 00:11 Go to previous messageGo to next message
Nanduri V Rao
Messages: 13
Registered: January 2000
Junior Member
Use the following command

insert into testtable values(123,secondtype(secondnest(1,test(123,'test'))));
Re: inserting into nested tables [message #370682 is a reply to message #370664] Wed, 19 January 2000 00:20 Go to previous messageGo to next message
Sunitha
Messages: 16
Registered: January 2000
Junior Member
Thanks. This is fine. Can you help us on how to insert another row into the test type table for the same values of testtable and secondtype table.

insert into testtable
values(123,secondtype(secondnest(1,test(124,'test1')))).

What I mean to ask is for a unique 123 testtable record with a unique secondtype 1, we should be able to add more than one record in test
Re: inserting into nested tables [message #370683 is a reply to message #370664] Wed, 19 January 2000 01:22 Go to previous messageGo to next message
Nanduri V Rao
Messages: 13
Registered: January 2000
Junior Member
While the first level of nesting is a nested table the second is not. What you have used there is the object that you created in the very first command. COnvert it into a nested table and then you should be able to insert more rows using 'THE' command
Re: inserting into nested tables [message #370686 is a reply to message #370664] Wed, 19 January 2000 06:37 Go to previous message
Sunitha
Messages: 16
Registered: January 2000
Junior Member
Does that mean we cannot have a second level nested table.

When I try inserting I get an error

PLS-00534: A Table type may not contain a nested table type or VARRAY.
Pls Help
Previous Topic: Re: Why so slow?
Next Topic: Duplicate Rows
Goto Forum:
  


Current Time: Sat Apr 20 08:10:27 CDT 2024