Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Creating an view that updates related tables

Re: Creating an view that updates related tables

From: Spencer <spencerp_at_swbell.net>
Date: Sun, 28 Jan 2001 23:50:33 -0600
Message-ID: <Aw7d6.1485$tW4.175404@nnrp2.sbc.net>

you need to alias one of the columns in order to create the view. the easiest way is using the AS keyword followed by the name the column will be known by in the view. e.g.

create or replace view my_view
as

select x.id1
     , x.my_col
     , y.my_col  As y_my_col

  from my_table x, my_table2 y
 where ...

btw... oracle will raise an exception if you attempt an insert into a view that is "non-key preserved".

"Jeff Boyer" <jdboyer@(remove)icomproductions.ca> wrote in message news:94psu9$gp6$1_at_news3.cadvision.com...
> Hello,
>
> Can someone tell me how to create a view of two related tables so I can
> Insert data into these tables at once. I have tried to make a view that
> joins two related tables but since I am Insetring into this view, I would
> assume that I have to have the Primary key from the parent table and the
> forigen key from the child table so I can insert data into each field.
> Oracle is telling me I have dupliacte coumns even though I am defining
 them
> as table1.field and table2.field. Can anyone help?
>
>
>
Received on Sun Jan 28 2001 - 23:50:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US