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: Insert with a relationship...

Re: Insert with a relationship...

From: Tom Zamani <tomz_at_redflex.com.au>
Date: 2000/05/31
Message-ID: <8h1kt8$r2p$1@perki.connect.com.au>#1/1

You have to insert the records yourself. however there is another ways to make oracle do the inserts ( using triggers)
FK/PK constraints only makes sure the referenced data exists. Tom
GAB <news4_at_REMOVEbaxnet.net> wrote in message news:MPG.139e1af3c3a43a51989690_at_news.usenetserver.com...
> I'm new to this - so here goes.
>
> Table STATE is the "one" (on the one side of the one-many relationship),
> with pri key column 'PK_State_ID'. Cool. Table ADDRESS is the "many",
> with foreign key column 'FK_State_ID' referring back to 'PK_State_ID'.
> STATE --> ADDR
>
> Am I even close with the following assumptions: ?
> 1) Make a user screen with all the Address info, have them fill it in.
> 2) When they get to the "State" field, use a drop-down and force them to
> find a valid State. (BTW - Georgia is not a valid state of any kind,
> neither is Alabama for that matter lol).
> 3) If "State" does not exist, pop up another screen to add correct
> state. Insert it. Now it should show up in #2.
> 3) Now I've got enough info to insert an ADDR record I guess.
>
> Here's my big puzzling question:
>
> If I fill in the SQL statement with all the ADDR data from my screen,
> will it then AUTOMATICALLY fill in the STATE field somehow since I've
> ensured the FK/PK constraint in ADDR? Or do I have to do manually add
> it to the insert statment, something like "insert into ADDR (street,
> city, stateid) values (screen.street, screen.city, STATE.ID)".
>
> In other words, how much is storage/retrieval is done for you during
> either the SELECT or INSERT due to the fact the constraint exists?
>
> I know this is awfully basic - sorry in advance
>
> Alex
>
>
>
Received on Wed May 31 2000 - 00:00:00 CDT

Original text of this message

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