Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
how to use index to avoid duplicates while inserting?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
deepali33

New User


Joined: 21 Sep 2008
Posts: 2
Location: pune

PostPosted: Sat Jul 10, 2010 10:06 am    Post subject: how to use index to avoid duplicates while inserting?
Reply with quote

Hi,

I have one temp table in which i need to insert record. the records has parent child relation. & when i insert parent its all child should be inserted into table. but if order of my records are like child1,child2,parent,child3,child4. then all child are moved properly but parent is not moved into table. so I wont get record of parent.

Please suggest solution.
Thanks in advance.
Back to top
View user's profile Send private message
References
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 15176
Location: 221 B Baker St

PostPosted: Sat Jul 10, 2010 12:42 pm    Post subject:
Reply with quote

Hello,

What you describe is not a db2 problem. . . It is a design/coding problem.

Usually, when there is a parent/child relatoinship, the parent row must be inserted first, then the child row(ws). These are usually in separate tables when a parent may have multiple child entries.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1