Re: Object features of Oracle8

From: Finn Ellebaek Nielsen <fen_at_changegroup.dk>
Date: Wed, 15 Sep 1999 21:04:10 +0100
Message-ID: <7roqs0$m4j$1_at_news.inet.tele.dk>


<burkeblackman_at_my-deja.com> wrote in message news:7rondg$pla$1_at_nnrp1.deja.com...
> Hello, I am trying to get the following to work:
> (this is straight out of ORACLE8: The Complete Reference)
> the types and table are defined as follows:
> SQL> desc address_ty -- this is the 1st type
> Name Null? Type
> ------------------------------- -------- ----
> STREET VARCHAR2(20)
> CITY VARCHAR2(20)
> STATE VARCHAR2(2)
> ZIP NUMBER
>
> SQL> desc person_ty -- this is the 2nd type
> Name Null? Type
> ------------------------------- -------- ----
> NAME VARCHAR2(20)
> ADDRESS ADDRESS_TY
>
> SQL> desc customer -- this is a table based upon those types
> Name Null? Type
> ------------------------------- -------- ----
> CUSTOMER_ID NUMBER
> PERSON PERSON_TY
>
> select person.name,
> person.address.state
> from customer;
>
> I get the following error when I do this in SQL*PLUS.
>
> select person.address.state from customer
> *
> ERROR at line 1:
> ORA-00904: invalid column name
>
> I have no problem inserting into the table, or selecting * from the
> table. But when I try to select just a single type-based column I get
> that error. This is how they do it in the book, I don't know what I'm
> doing wrong. Any help would be appreciated!
>
> Burke
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

For some obscure reason you have to prefix PERSON with the table name or an alias, ie:

select c.person.name,

       c.person.address.state
from customer c;

HTH. Finn Received on Wed Sep 15 1999 - 22:04:10 CEST

Original text of this message