Vinod,
Again, what you need to do is dependent on what you are doing with this data after you've got it. If you are showing it on screen you can program the interface to not display the repeating values, if a report is being printed the report fields can be marked to surpress repetaing values.
You can desing a screen with a grid where you show the parent data in textboxes in the screen and the child data in the grid.
IOW, you don't need to do what you are trying to do. You can leave those values in the cursor and surpress their display.