dbTalk Databases Forums  

simple query with types problem

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss simple query with types problem in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Shearer
 
Posts: n/a

Default simple query with types problem - 11-09-2008 , 03:43 AM






create or replace type IndirizzoTY as object
(via varchar(30),
comune varchar(20),
provincia char(2));

create or replace type PersonaTY as object
(cognome varchar(20),
nome varchar(15),
indirizzo indirizzoTY);

create table Persona of PersonaTY;

insert into persona values('Insegno','Pino',IndirizzoTY('Via
Dante','Roma','Rm'));
-----------------------------------------------------------------------------------------

select indirizzo.via from persona;

ORA-00904: "INDIRIZZO"."VIA": identificativo non valido

.....
Which is the correct sql command?



Reply With Quote
  #2  
Old   
Viktor Wiens
 
Posts: n/a

Default Re: simple query with types problem - 11-09-2008 , 04:06 AM






Quote:
select indirizzo.via from persona;
select a.indirizzo.via from persona a


Reply With Quote
  #3  
Old   
Viktor Wiens
 
Posts: n/a

Default Re: simple query with types problem - 11-09-2008 , 04:06 AM



Quote:
select indirizzo.via from persona;
select a.indirizzo.via from persona a


Reply With Quote
  #4  
Old   
Viktor Wiens
 
Posts: n/a

Default Re: simple query with types problem - 11-09-2008 , 04:06 AM



Quote:
select indirizzo.via from persona;
select a.indirizzo.via from persona a


Reply With Quote
  #5  
Old   
Viktor Wiens
 
Posts: n/a

Default Re: simple query with types problem - 11-09-2008 , 04:06 AM



Quote:
select indirizzo.via from persona;
select a.indirizzo.via from persona a


Reply With Quote
  #6  
Old   
Shakespeare
 
Posts: n/a

Default Re: simple query with types problem - 11-09-2008 , 04:06 AM



Shearer schreef:
Quote:
create or replace type IndirizzoTY as object
(via varchar(30),
comune varchar(20),
provincia char(2));

create or replace type PersonaTY as object
(cognome varchar(20),
nome varchar(15),
indirizzo indirizzoTY);

create table Persona of PersonaTY;

insert into persona values('Insegno','Pino',IndirizzoTY('Via
Dante','Roma','Rm'));
-----------------------------------------------------------------------------------------

select indirizzo.via from persona;

ORA-00904: "INDIRIZZO"."VIA": identificativo non valido

....
Which is the correct sql command?


Try this:

select p.indirizzo.via from persona p;

Somewhere I read (can't rememeber where) that user defined types should
be accessed via the alias of the table.
I tested this on Oracle XE and it works!

Shakespeare


Reply With Quote
  #7  
Old   
Shakespeare
 
Posts: n/a

Default Re: simple query with types problem - 11-09-2008 , 04:06 AM



Shearer schreef:
Quote:
create or replace type IndirizzoTY as object
(via varchar(30),
comune varchar(20),
provincia char(2));

create or replace type PersonaTY as object
(cognome varchar(20),
nome varchar(15),
indirizzo indirizzoTY);

create table Persona of PersonaTY;

insert into persona values('Insegno','Pino',IndirizzoTY('Via
Dante','Roma','Rm'));
-----------------------------------------------------------------------------------------

select indirizzo.via from persona;

ORA-00904: "INDIRIZZO"."VIA": identificativo non valido

....
Which is the correct sql command?


Try this:

select p.indirizzo.via from persona p;

Somewhere I read (can't rememeber where) that user defined types should
be accessed via the alias of the table.
I tested this on Oracle XE and it works!

Shakespeare


Reply With Quote
  #8  
Old   
Shakespeare
 
Posts: n/a

Default Re: simple query with types problem - 11-09-2008 , 04:06 AM



Shearer schreef:
Quote:
create or replace type IndirizzoTY as object
(via varchar(30),
comune varchar(20),
provincia char(2));

create or replace type PersonaTY as object
(cognome varchar(20),
nome varchar(15),
indirizzo indirizzoTY);

create table Persona of PersonaTY;

insert into persona values('Insegno','Pino',IndirizzoTY('Via
Dante','Roma','Rm'));
-----------------------------------------------------------------------------------------

select indirizzo.via from persona;

ORA-00904: "INDIRIZZO"."VIA": identificativo non valido

....
Which is the correct sql command?


Try this:

select p.indirizzo.via from persona p;

Somewhere I read (can't rememeber where) that user defined types should
be accessed via the alias of the table.
I tested this on Oracle XE and it works!

Shakespeare


Reply With Quote
  #9  
Old   
Shakespeare
 
Posts: n/a

Default Re: simple query with types problem - 11-09-2008 , 04:06 AM



Shearer schreef:
Quote:
create or replace type IndirizzoTY as object
(via varchar(30),
comune varchar(20),
provincia char(2));

create or replace type PersonaTY as object
(cognome varchar(20),
nome varchar(15),
indirizzo indirizzoTY);

create table Persona of PersonaTY;

insert into persona values('Insegno','Pino',IndirizzoTY('Via
Dante','Roma','Rm'));
-----------------------------------------------------------------------------------------

select indirizzo.via from persona;

ORA-00904: "INDIRIZZO"."VIA": identificativo non valido

....
Which is the correct sql command?


Try this:

select p.indirizzo.via from persona p;

Somewhere I read (can't rememeber where) that user defined types should
be accessed via the alias of the table.
I tested this on Oracle XE and it works!

Shakespeare


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.