I got a object and table.
Object: emp_address(state varchar2(10), zip number(6));
Table: emp (emp_name varchar2(30) PK,
How can i insert two or more address for the same emp_name?
Sun Certified Sys. Admin
Go for varray or nested table type of that object type. This will allow you to insert more than one address for the same emp_name
create type emp_address as object
(state varchar2(10), zip number(6));
create type emp_address_vrr as varray(4) of emp_address ;
create type emp_address_nest is table of emp_address ;
create table emp (emp_name varchar2(30),
address1 emp_address_vrr ,
address2 emp_address_nest )
NESTED TABLE address2 STORE AS address;
If you know maximum how many address u can insert for one emp_name then go for varray, but if you don't know the number then go for nested table.
Click Here to Expand Forum to Full Width