Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Please Help: Can't use Objects in Oracle 8!
On Wed, 21 Jan 1998 11:11:04 -0500, Jack Burton <jackb_at_pgw.picker.com> wrote:
>This is my first post to this news group. If the content of this post
>is inappropriate for this group than please point me in the right
>direction.
>
>I'm runnning Oracle 8.03 on A Dec Alpha running Digtal Unix 4.0B
>
>I am trying to create a table that uses an Object and can't. I've tried
>examples in the Oracle 8 Documentation and from the Article "Extending
>Oracle8 With Objects" from the Oracle Magazine (Aug/Sep - Oct/Nov
>1997). I can create an object but cannot reference the object from
>withing a
>table.
>
>ie.
>
>create or replace type Address_Type as object (
>street1 varchar(50),
>street2 varchar(50),
>city varchar(50),
>state varchar(25),
>zipcode varchar(10),
>country varcode(50)
>);
>
>Statement Processed
>
>create table customers (
>id INTEGER PRIMARY KEY,
>lastname VARCHAR2(50),
>firstname VARCHAR2(50),
>phone VARCHAR(20)
>address Address_Type
>);
>
>
>address Address_Type
> *
>ORA-0092: invalid datatype
>
>
>What am I doing wrong?
>
there are at least 2 typos in your example
1- country varcode(50) should be varchar(50) 2- you are missing a comma after phone varchar(20) which would cause the address address_type line to be interpreted wrong.
When you fix those, you should see:
SQL> create or replace type Address_Type as object (
2 street1 varchar(50),
3 street2 varchar(50),
4 city varchar(50),
5 state varchar(25),
6 zipcode varchar(10),
7 country varchar(50)
8 );
9 /
Type created.
SQL>
SQL> create table customers
2 ( id INTEGER PRIMARY KEY,
3 lastname VARCHAR2(50),
4 firstname VARCHAR2(50),
5 phone VARCHAR(20),
6 address Address_Type
7 );
Table created.
SQL>
Don't forget the slash after the CREATE TYPE (not needed after the create table
and in fact would cause an error)...
>
>TIA,
>
>JAck
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu Jan 22 1998 - 00:00:00 CST