I have this Oracle code:
Create type address_ty as object( street varchar2(50),city varchar2(50),prov varchar2(50),cap number);
Create type person_ty as object( name varchar2(50), address address_ty);
Create table client (client_id number,person person_ty);
insert into client
values(1,person_ty('pinco pallo',
address_ty('Boulevard street' ,'torino','to',10100)));
Commit;
select c.client_id,
c.person.name,
c.person.address.street,
c.person.address.city,
c.person.address.prov,
c.person.address.cap
from client c;
Everything works good.
Now i want to update c.person.address.prov
I tried with:
update client
set client.person.address.prov='MI'
where client.client_id=1
But i get an error.
Ora-00904: "client.person.address.prov" invalid identifier.
How can i update the field prov??
Thank you for your answer.
Best Answer
Use an alias. It is mandatory when updating a table with an object type. UPDATE