DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Object Type

  1. #1
    Join Date
    Dec 1999
    Location
    Alpharetta, GA, US
    Posts
    192
    Hi,
    I got a object and table.
    like

    Object: emp_address(state varchar2(10), zip number(6));

    Table: emp (emp_name varchar2(30) PK,
    address emp_address);

    How can i insert two or more address for the same emp_name?

    Thanks.
    Chan
    OCP7.3/8.0/8i/9i
    Sun Certified Sys. Admin

  2. #2
    Join Date
    Apr 2001
    Posts
    24
    Hello,

    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

  3. #3
    Join Date
    Apr 2001
    Posts
    24
    For Example:
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width