I have two tables with many relationships. (Oracle)
**Table: PARENT** Field: A (PK) Field: B Field: C1 Field: C2 Field: C3 Field: C4 Field: C5 **Table CHILD** Field: A (PK) (FK to PARENT.A) Field: D (PK) Field: E
Records inserted into child and parent tables are inserted at the same time.
What interests me is the most efficient way to do this.
Currently, there is one stored procedure called by the calling application for the entire insertion phase. The stored procedure currently has the following link:
Field: A Field: B Field: C (dilimited string) Field: D (dilimited string) Field: E (dilimited string)
The procedure goes through C from the input and stores each of the values ββin an array. It then uses this array along with A and B from the input to insert into the PARENT table.
Then it uses A from the input and goes through D and E from the input and inserts into the CHILD table for each element in the agreed rows.
It will be triggered up to 3 million times a day. This should be as effective as possible.
How effective is the loss of multiple SP calls, not just one?
All loops to take care of thickened strings seem like a lot of work!
I thought that the calling application could make separate SP calls for each entry in CHILD. However, how can I guarantee that somehow the insert in CHILD will not happen before the insert in PARENT ... and this will be more calls to stored procedures. (in many cases there are no child records to insert when they are usually less than 10, but maybe as many as 50)
I am also opening another way to get the information in extended string C.
Is there something more efficient than a while loop to get information from strength strings?
I did not write SP. I was asked to make a small modification and make it more efficient, if possible.
Any ideas?
Notes:
I simplified the tables, in fact there are 10 elements in the allowed row of C not 5, there are two more more stretched rows like C that are inserted into the PARENT table. The tables also have several fields than shown
Entries are deleted after 30 days.