• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

updation of multiple rows

Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a mail management system application which has mailboxes and emails in it. The architecture is like this:
there is a table called email which contains all the emails for all the users, irrespective of the mailbox. there is a field emailid for each email(primary key) and mailbox id for a particular emailid.
Now according to application ,user of one mailbox can pull emails from other mailbox, to its own mailbox. For this user just has to specify the mailbox and the number of emails to be pulled to his/her mailbox, from the specified mailbox.
Now for this operation, following things are done:
1. Select all the emailids for a specified mailbox.
2. Filter out the first n number of emailids(this is same as the number of emails user wants to pull).
3. Update the mailboxid for each email in the email table.
(for this seperate query is fired for each email).
So if the user trys to pull a huge number, say 30-40 emails from a mailbox, it takes a lot of time.
Can somebody tell me a better way to do this.
Should I use stored procedure for this, but this won't decrease the number of queries.
or should I use prepared statement.
Also can the concept of cursor be helpful here?
I don't want to modify the already existing tables.
Your suggestion will be very helpful.
Could you hold this puppy for a sec? I need to adjust this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic