Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Whats the diffrence
Amogh wrote:
> Khurram wrote:
> > hi
> >
> > CREATE TYPE person AS OBJECT (
> > name VARCHAR2(30),
> > phone VARCHAR2(20) );
> >
> > CREATE TABLE person_table OF person;
> >
> >
> > SQL> CREATE TABLE person_table OF person;
> >
> > Table created.
> >
> > SQL> INSERT INTO person_table VALUES ('KHURRAM','6987270');
> >
> > 1 row created.
> >
> > SQL> SELECT * FROM person_table;
> >
> > NAME PHONE
> > ------------------------------ --------------------
> > KHURRAM 6987270
> >
> > SQL> CREATE TABLE person_table1 (a PERSON);
> >
> > Table created.
> >
> > SQL> INSERT INTO person_table1 VALUES (person('KHURRAM','6987270'));
> >
> > 1 row created.
> >
> > SQL> SELECT * FROM person_table1;
> >
> > A(NAME, PHONE)
> > ---------------------------------------------------------------------
> > PERSON('KHURRAM', '6987270')
> >
> > My question is whats the differnce between
> >
> > CREATE TABLE <tablename> OF <object type name>;
> >
> > and
> >
> > CREATE TABLE <tablename>
> > (<columnname> <object type name>);
> >
> > Which is best to use ?
> > Is there any performance,syntax issue?
> >
> > Khurram
> >
>
> > CREATE TABLE <tablename> OF <object type name>;
> >
> is an Object Table, where every row is an Object,
> more known as a Row Object.
>
> > CREATE TABLE <tablename>
> > (<columnname> <object type name>);
>
> is a Relational table with an Object column. Simple,
> where the object-type is a column object.
>
> By default every row-object will be associated with a OID
> (object id), where as a column object will not be.
>
> One can create a reference datatype (REF) only to row objects.
> REF's cannot be created to column objects. Depends on the storage
> considerations one has for his/her schema.
>
> Rgds.
> Amogh
Thanx Amogh I got it now :) Received on Mon Jul 10 2006 - 02:47:04 CDT
![]() |
![]() |