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

Insert with a relationship...

From: GAB <news4_at_REMOVEbaxnet.net>
Date: 2000/05/30
Message-ID: <MPG.139e1af3c3a43a51989690@news.usenetserver.com>#1/1

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 Tue May 30 2000 - 00:00:00 CDT

Original text of this message

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