Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6531269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:51:28+00:00 2026-05-25T09:51:28+00:00

I have two tables with a many-to-one relationship. (Oracle) **Table: PARENT** Field: A (PK)

  • 0

I have two tables with a many-to-one relationship. (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 the child and parent tables are inserted at the same time.

What I am wondering is what is the most efficient way to do this.

Currently there is one stored procedure that is called by the calling application for this whole insert step. The stored procedure currently has the following signiture:

Field: A
Field: B
Field: C (dilimited string)
Field: D (dilimited string)
Field: E (dilimited string)

The procedure loops through C from the input and stores each of the values in an array. Then uses that array along with A and B from the input to insert into table PARENT.

Then the uses A from the input and loops through D and E from the input and makes an insert into table CHILD for each item in the dilimited strings.

This will be called up to 3 million times per day. It needs to be as efficient as possible.

How much efficency is lost when making multiple SP calls rather than just one?

All the looping to take care of the dilimited strings seem like a lot of work!

I was thinking that the calling application could make seperate SP calls for each of the entries into CHILD. However, how can I ensure that somehow the insert into CHILD wont happen before the insert into PARENT… and that would be more stored procedure calls. (many times there is no child records to insert, when there is there is generally less than 10, but could be as many as 50)

I also open to another way to get the information in dilimted string C.

Is there something more efficent than a while loop to get the information from dilimited strings?

I didn’t write the SP I was asked to make a small modification and make it more efficent if possible.

Any ideas?

Notes:

I simplified the tables, there are actually 10 items in dilitied string C not 5, there are also two more dilited strings just like C that get inserted into table PARENT. The tables also have several more fields than shown

Records are deleted after 30 days.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:51:29+00:00Added an answer on May 25, 2026 at 9:51 am

    There are a couple of things here….

    First, if you’re looping through a delimited string to put similar items in similar columns, you likely need to refactor your tables to be more normalized. For example, if C is a delimited list of phone numbers, and columns C1 – C5 are phone1 – phone5, you should likely have a separate child phone table. This is dependant on use case, but strikes me as a potential future problem (ie knowledge of the delimiter).
    If the delimited string has dis-similar data in it (phone number, city, name, etc) – please make separate entry paramets for each separate data element. This is an even bigger potential problem (because if the order of the entries is important, you’re screwed, period).

    You’re right, looping over delimited strings is a lot of work. There’s not necessarily a better way to do it, unless possibly if your RDBMS has some sort of built-in split function or something (or you can call an external function). I’d rather avoid it if I could, and call a child stored procedure. It’s going to have to be per-child, but that’s actually better anyways – not necessarily performance wise, but for conceptualizing it, and future maintanence.

    How to prevent a child row from being inserted without a parent? Use a foreign key constraint. If the constraint is violated, it’s the caller’s fault, and not the DB’s.

    Okay, some of these require some major changes to the SP, and some require changes to the underlying table structure (which, if it was initially set up correctly, should be mostly transparent to the users). But this is what I would have attempted…

    Oh, and pease tell me this is all running under commitment control…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables connected with one to many relationship. Parent Table is a
I have two tables that have a one-to-many relationship. The primary key of table
I have a one to many relationship between two tables. The many table contains
android noob... I have two tables, with a one to many relationship between country_tbl
I have two tables with a many to many relationship, through a third table.
I have two tables with a linking table describing their many-to-many relationship. TABLE buildings
I have two tables - 'business' and 'business_contacts'. The business_contact table has a many-to-one
We have two tables, ActivityForm and Field which are given a many-to-many relationship via
I have two tables in a one to many relationship. (products and qty break
I have two tables: invoices & invoice_items. I need a one to many relationship

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.