Question on Oracle Database Design [message #206352] |
Wed, 29 November 2006 13:22 |
suranjita_hajra_7
Messages: 20 Registered: November 2006 Location: Pittsburgh, USA
|
Junior Member |
|
|
Hello,
I have a question on Oracle Database Design.
I have a parent table with "Sales_Order_Head" column and this column is a PRIMARY KEY in this parent table. I also have a child table with "Sales_Order_Line" column and this column is a Foreign Key to the primary key column in the parent table.
Now my requirement is that when I insert a record in the primary key column - "Sales_Order_Head" of the parent table, I want that simultaneously a record should get inserted in "Sales_Order_Line" column of the child table. I know that this can be implemented programmatically but I have to implement this at design level.
How can I do this, please suggest me.
Thanks a lot in advance.
Regards,
Suranjita
|
|
|
Re: Question on Oracle Database Design [message #206353 is a reply to message #206352] |
Wed, 29 November 2006 13:26 |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Why did you post this in the PL/SQL-experts forum if you're not interested in a programming-solution?
I don't get it when you say "I know that this can be implemented programmatically but I have to implement this at design level."
Could you please explain?
|
|
|
|
|
|
|
Re: Question on Oracle Database Design [message #218033 is a reply to message #206352] |
Tue, 06 February 2007 08:27 |
ora_balan
Messages: 21 Registered: January 2007 Location: Mumbai, India
|
Junior Member |
|
|
One way out is to indicate the mandatory child record requirement in your ER Diagram design and leave it later for the programmer to do the actual coding.
In the ER Diagrammer, create 2 entities, 1 for the master and 1 for the child. When you create a relation between the two, use the M:1 (mandatory to mandatory) Relationship. This would be a an icon that you'll see attached to this reply.
As a system analyst, I use that to indicate at least 1 child record to be mandatorily created whenever a Parent record comes into existence.
Of course, you'll need to back this up by a subsequent code which reflects such a design.
Hope this helps.
|
|
|
|