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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Data Normalization & Working with Views

Re: Data Normalization & Working with Views

From: DA Morgan <damorgan_at_psoug.org>
Date: Fri, 03 Jun 2005 15:19:09 -0700
Message-ID: <1117837026.76206@yasure>


Chris wrote:
> I'm working with ORacle 10g on HP-UX 11i. I am relatively new to data
> normalization (the previous database I was working with was a complete
> nightmare of replicated information) and working with views, so please
> bear with my ignorance here.
>
> If you have two tables:
>
> FIRSTNAME (
> ID INTEGER,
> NAME VARCHAR2(10),
> LASTNAME_ID INTEGER ) -+
> |
> and |
> |
> LASTNAME ( |
> ID INTEGER, -+
> NAME VARCHAR2(10) )
>
> Where FIRSTNAME has a foreign key relationship established with
> LASTNAME based on ID.
>
> And you define the following view:
>
> v_NAMES (
> SELECT
> FIRSTNAME.NAME,
> LASTNAME.NAME
> FROM
> FIRSTNAME, LASTNAME
> WHERE
> FIRSTNAME.LASTNAME_ID = LASTNAME.ID )
>
> How do you go about inserting new records into the view.
>
> Suppose I want to put "John Doe" into the view.
>
> I'm wondering how one goes about this from a programming standpoint.
> Obviously this is a very simplified/quickly thrown together example,
> but I'm looking to understand the basic concept here.
>
> Any and all help is much appreciated.

In addition to what Mark has said, which is quite valuable, inserting through views that join multiple tables can be problematic without writing INSTEAD-OF triggers which I think are beyond the scope of where you would be comfortable.

Better to properly design and then insert directly into the tables themselves.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Fri Jun 03 2005 - 17:19:09 CDT

Original text of this message

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